[PATCH] parse/ast: improve error handling for invalid task dependencies

Matt Madison <[email protected]> Wed, 29 Jul 2026 07:29:24 -0700
Newsgroups org.openembedded.lists.bitbake-devel
Message-ID <[email protected]>
The per-recipe providers handling that went int with commit
fb119c7888ae8a749aa824f8c51780176af077f9 throws a ValueError
exception if an entry in a task's [depends] list is malformed.

This results in a traceback of the form:

  ERROR: Unable to parse <recipe-name>
  Traceback (most recent call last):
    File "<top>/bitbake/lib/bb/cooker.py", line 2334, in parse_next
      raise result
  ValueError: not enough values to unpack (expected 2, got 1)

  ERROR: Parsing halted due to errors, see error messages above

which makes it difficult to find the source of the parsing problem,
particularly if the invalid dependency is added in a bbclass that
is shared across many recipes.

Fix this by catching the ValueError and issuing a fatal error
message with more information about the problem.

Signed-off-by: Matt Madison <[email protected]>
---
 lib/bb/parse/ast.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/bb/parse/ast.py b/lib/bb/parse/ast.py
index e23ef6db3..a372b3534 100644
--- a/lib/bb/parse/ast.py
+++ b/lib/bb/parse/ast.py
@@ -507,7 +507,10 @@ def handleVirtRecipeProviders(tasklist, d):
         taskdeps = (d.getVarFlag(task, "depends") or "").split()
         remapped = []
         for entry in taskdeps:
-            r, t = entry.split(":")
+            try:
+                r, t = entry.split(":")
+            except ValueError:
+                bb.fatal("Error, incorrect format for task dependency (task '%s'): %s" % (task, entry))
             if r in virtprovs:
                 r = d.getVar("PREFERRED_PROVIDER_" + r)
             remapped.append("%s:%s" % (r, t))
-- 
2.43.0