gastownhall/beads · error

node %q: dep %d: invalid dependency type %q

Error message

node %q: dep %d: invalid dependency type %q

What it means

Dependency types in deps[].type, when set, must be one of the valid types.DependencyType values (checked via IsValid). Unknown type strings are rejected at plan validation time.

Source

Thrown at cmd/bd/graph_apply.go:586

			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 == "" {
			return fmt.Errorf("edge %d: must specify from_key or from_id", i)
		}
		if edge.ToKey == "" && edge.ToID == "" {
			return fmt.Errorf("edge %d: must specify to_key or to_id", i)
		}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Replace the type with a valid dependency type string
  2. Omit the type field entirely if the default type is acceptable
  3. Check the valid dependency type list in the types package for exact spelling

Example fix

// before
{"deps": [{"type": "related-to", "target": "build"}]}
// after
{"deps": [{"type": "relates-to", "target": "build"}]}
Defensive patterns

Strategy: validation

Validate before calling

valid := map[string]bool{"blocks": true, "related": true /* plus other valid types */}
for _, n := range plan.Nodes {
	for _, d := range n.Deps {
		if d.Type != "" && !valid[d.Type] { return fmt.Errorf("invalid dep type %q", d.Type) }
	}
}

Try / catch

if err := bd.GraphApply(ctx, plan, opts); err != nil {
	if strings.Contains(err.Error(), "invalid dependency type") {
		// correct the type string and retry
	}
}

Prevention

When it happens

Trigger: `bd graph apply` with a dep whose type is a non-empty string not in the valid dependency type set (e.g. "dependson" instead of a recognized type).

Common situations: Typos or casing mistakes in type names; using types from a different tool's vocabulary; older plans written against a removed type name.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/2a462b82cf9b7e51. Report an issue: GitHub.