gastownhall/beads · error

invalid dependency type %q for issue %q

Error message

invalid dependency type %q for issue %q

What it means

parseMarkdownDependencies parses dependency lines (e.g. 'blocks:BD-123') from a markdown issue template. Each parsed dep type must pass types.DepType.IsValid(); this error is thrown when a prefix (or unprefixed raw token) maps to a dependency type string that the types package does not recognize. It guards against typos or malformed prefix syntax in markdown dependency blocks before any dependency is created.

Source

Thrown at cmd/bd/markdown.go:461

		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 {
	if in.jsonOutput {
		return outputJSON(issues)
	}
	fmt.Printf("%s Created %d issues from %s:\n", ui.RenderPass("✓"), len(issues), in.markdownFile)
	for _, issue := range issues {
		fmt.Printf("  %s: %s [P%d, %s]\n", issue.ID, issue.Title, issue.Priority, issue.IssueType)
	}
	return nil
}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Fix the dependency type keyword in the markdown to a valid type (blocks, related, parent-child, discovered-from, etc.)
  2. Run `bd dep --help` (or check types.DepType valid values) to list accepted dependency types
  3. Regenerate the markdown from `bd export` so syntax matches the current version
  4. If a new dep type is genuinely needed, add it to types.DepType and its IsValid() set

Example fix

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

Strategy: validation

Validate before calling

const validDepTypes = new Set(['blocks','related','parent-child','discovered-from','discovered-by']);
for (const line of depLines) {
  const [type, target] = parseDepLine(line);
  if (!validDepTypes.has(type)) throw new Error(`unknown dep type: ${type}`);
}

Type guard

function isDepType(s) { return ['blocks','related','parent-child','discovered-from','discovered-by'].includes(s); }

Prevention

When it happens

Trigger: A markdown dependency line uses an unknown prefix (e.g. 'depends:BD-5', 'blocked-by:BD-5') that is stripped to a depType string which is not one of the valid DepType values; the raw token without a recognized prefix is passed through as depType = types.DepBlocks only when the remainder splits into two parts, otherwise an invalid type reaches the IsValid check.

Common situations: Hand-edited issue markdown using a wrong dependency keyword; templates copied from another tool (GitHub-style 'blocked by' prose); a newer/older bd version writing dep-type spellings the current binary doesn't know.

Related errors


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