{"record":{"id":"c5c2d78a46226b71","repo":"gastownhall/beads","slug":"invalid-dependency-type-q-for-issue-q","errorCode":null,"errorMessage":"invalid dependency type %q for issue %q","messagePattern":"invalid dependency type %q for issue %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/markdown.go","lineNumber":461,"sourceCode":"\t\tif raw == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tvar depType types.DependencyType\n\t\tvar target string\n\t\tif strings.Contains(raw, \":\") {\n\t\t\tparts := strings.SplitN(raw, \":\", 2)\n\t\t\tif len(parts) != 2 {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid dependency format %q for issue %q\", raw, templateTitle)\n\t\t\t}\n\t\t\tdepType = types.DependencyType(strings.TrimSpace(parts[0]))\n\t\t\ttarget = strings.TrimSpace(parts[1])\n\t\t} else {\n\t\t\tdepType = types.DepBlocks\n\t\t\ttarget = raw\n\t\t}\n\t\tif !depType.IsValid() {\n\t\t\treturn nil, fmt.Errorf(\"invalid dependency type %q for issue %q\", depType, templateTitle)\n\t\t}\n\t\tout = append(out, issueops.CreateDependency{Type: depType, TargetID: target})\n\t}\n\treturn out, nil\n}\n\n// reportMarkdownBatch prints what the batch created, in the one shape both\n// routes print.\nfunc reportMarkdownBatch(issues []*types.Issue, in createInput) error {\n\tif in.jsonOutput {\n\t\treturn outputJSON(issues)\n\t}\n\tfmt.Printf(\"%s Created %d issues from %s:\\n\", ui.RenderPass(\"✓\"), len(issues), in.markdownFile)\n\tfor _, issue := range issues {\n\t\tfmt.Printf(\"  %s: %s [P%d, %s]\\n\", issue.ID, issue.Title, issue.Priority, issue.IssueType)\n\t}\n\treturn nil\n}","sourceCodeStart":443,"sourceCodeEnd":479,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/markdown.go#L443-L479","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Fix the dependency type keyword in the markdown to a valid type (blocks, related, parent-child, discovered-from, etc.)","Run `bd dep --help` (or check types.DepType valid values) to list accepted dependency types","Regenerate the markdown from `bd export` so syntax matches the current version","If a new dep type is genuinely needed, add it to types.DepType and its IsValid() set"],"exampleFix":"// before\ndepends on: bd-42\n// after\nblocks: bd-42","handlingStrategy":"validation","validationCode":"const validDepTypes = new Set(['blocks','related','parent-child','discovered-from','discovered-by']);\nfor (const line of depLines) {\n  const [type, target] = parseDepLine(line);\n  if (!validDepTypes.has(type)) throw new Error(`unknown dep type: ${type}`);\n}","typeGuard":"function isDepType(s) { return ['blocks','related','parent-child','discovered-from','discovered-by'].includes(s); }","tryCatchPattern":null,"preventionTips":["Generate dependency markdown via bd commands instead of hand-editing","Keep a list of valid dep types in your template linter","Run bd export/validate on markdown before batch import"],"tags":["parsing","markdown","validation","dependencies"],"backgroundTag":"invalid-dependency-type","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}