gastownhall/beads · error
node %q: dep %d has empty target
Error message
node %q: dep %d has empty target
What it means
Each entry in a node's deps array must have a non-empty `target`. An empty target makes the dependency unresolvable, so validation rejects the plan with the node key and dep index.
Source
Thrown at cmd/bd/graph_apply.go:581
}
}
}
parentKey := node.effectiveParentKey()
if parentKey != "" && !seenKeys[parentKey] {
found := false
for _, other := range plan.Nodes {
if other.Key == parentKey {
found = true
break
}
}
if !found {
return fmt.Errorf("node %q: parent key %q not found in plan", node.Key, parentKey)
}
}
for j, dep := range node.Deps {
if dep.Target == "" {
return fmt.Errorf("node %q: dep %d has empty target", node.Key, j)
}
if dep.Type != "" {
dt := types.DependencyType(dep.Type)
if !dt.IsValid() {
return fmt.Errorf("node %q: dep %d: invalid dependency type %q", node.Key, j, dep.Type)
}
}
}
}
for i, edge := range plan.Edges {
if edge.FromKey != "" && !seenKeys[edge.FromKey] {
return fmt.Errorf("edge %d: from key %q not found in plan", i, edge.FromKey)
}
if edge.ToKey != "" && !seenKeys[edge.ToKey] {
return fmt.Errorf("edge %d: to key %q not found in plan", i, edge.ToKey)
}
if edge.FromKey == "" && edge.FromID == "" {View on GitHub (pinned to 71377f2769)
Solutions
- Set deps[j].target to the key (or id) of the dependency target node
- Remove the empty dep entry if it is spurious
- Fix the generator so targets are always populated
Example fix
// before
{"key": "deploy", "deps": [{"type": "blocks", "target": ""}]}
// after
{"key": "deploy", "deps": [{"type": "blocks", "target": "build"}]} Defensive patterns
Strategy: validation
Validate before calling
for i, n := range plan.Nodes {
for j, d := range n.Deps {
if d.Target == "" { return fmt.Errorf("node %s dep %d empty target", n.Key, j) }
}
} Try / catch
if err := bd.GraphApply(ctx, plan, opts); err != nil {
if strings.Contains(err.Error(), "has empty target") {
// fill or remove the dep and retry
}
} Prevention
- Construct deps with a helper that requires a target argument
- Filter out zero-value dep structs before building the plan
- Schema-validate plan files to require dep.target
When it happens
Trigger: `bd graph apply` where plan.nodes[i].deps[j] has `"target": ""` or the target field is omitted.
Common situations: Programmatic plan generation that emits dep objects with unfilled targets; hand-editing plans and clearing a target; template loops emitting placeholder dep entries.
Understand the failure class
Background: "Missing required field" and "field is required" errors: why libraries reject payloads that omit mandatory fields — this error's family across 20 libraries.
Related errors
- node %q has empty title
- edge %d: must specify from_key or from_id
- duplicate node key %q
- duplicate explicit id %q (node %q)
- node %q: metadata ref %q references unknown key %q
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/a8032ea0789f0587.
Report an issue: GitHub.