gastownhall/beads · error

invalid dependency format %q for issue %q

Error message

invalid dependency format %q for issue %q

What it means

Markdown dependency lines use `type:target` (e.g. `blocks:BD-123`); parseMarkdownDependencies splits on the first colon and validates it yields exactly two parts. Because SplitN with n=2 always returns one or two parts, this error fires when the raw token contains no colon in this branch's expectation being violated or the raw value is otherwise malformed (e.g. empty or whitespace-only segment), producing an invalid dependency spec for the given issue title.

Source

Thrown at cmd/bd/markdown.go:452

	return nil
}

// parseMarkdownDependencies reads a template's `### Dependencies` section as
// the role's edge specs. `type:target` names the type; a bare target blocks.
func parseMarkdownDependencies(deps []string, templateTitle string) ([]issueops.CreateDependency, error) {
	var out []issueops.CreateDependency
	for _, raw := range deps {
		raw = strings.TrimSpace(raw)
		if raw == "" {
			continue
		}

		var depType types.DependencyType
		var target string
		if strings.Contains(raw, ":") {
			parts := strings.SplitN(raw, ":", 2)
			if len(parts) != 2 {
				return nil, fmt.Errorf("invalid dependency format %q for issue %q", raw, templateTitle)
			}
			depType = types.DependencyType(strings.TrimSpace(parts[0]))
			target = strings.TrimSpace(parts[1])
		} else {
			depType = types.DepBlocks
			target = raw
		}
		if !depType.IsValid() {
			return nil, fmt.Errorf("invalid dependency type %q for issue %q", depType, templateTitle)
		}
		out = append(out, issueops.CreateDependency{Type: depType, TargetID: target})
	}
	return out, nil
}

// reportMarkdownBatch prints what the batch created, in the one shape both
// routes print.
func reportMarkdownBatch(issues []*types.Issue, in createInput) error {

View on GitHub (pinned to 71377f2769)

Solutions

  1. Fix the dependency line to full `type:target` form, e.g. `blocks:bd-42`
  2. Remove empty or truncated dependency entries from the markdown
  3. Ensure the target issue exists / is spelled correctly
  4. Use the bare-target shorthand (no colon) if you just want a plain `blocks` dependency

Example fix

// before
Depends on: blocks:
// after
Depends on: blocks:bd-42
Defensive patterns

Strategy: validation

Validate before calling

func validDep(raw string) bool {
	if !strings.Contains(raw, ":") {
		return strings.TrimSpace(raw) != "" // bare blocks shorthand
	}
	parts := strings.SplitN(raw, ":", 2)
	return strings.TrimSpace(parts[0]) != "" && strings.TrimSpace(parts[1]) != ""
}

Prevention

When it happens

Trigger: A `Depends on`/dependency field line for an issue in the markdown contains a malformed `raw` entry — e.g. `"blocks:"` with empty target or a token that fails the two-part split — while building the batch request from parsed issue templates.

Common situations: Hand-edited markdown where a dependency value was truncated ("blocks:" with no target); copy-paste dropping text after the colon; template generators emitting empty dependency entries; typos like an extra colon creating unexpected segments in surrounding validation.

Related errors


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