{"record":{"id":"2a462b82cf9b7e51","repo":"gastownhall/beads","slug":"node-q-dep-d-invalid-dependency-type-q","errorCode":null,"errorMessage":"node %q: dep %d: invalid dependency type %q","messagePattern":"node %q: dep (.+?): invalid dependency type %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/graph_apply.go","lineNumber":586,"sourceCode":"\t\t\tfound := false\n\t\t\tfor _, other := range plan.Nodes {\n\t\t\t\tif other.Key == parentKey {\n\t\t\t\t\tfound = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !found {\n\t\t\t\treturn fmt.Errorf(\"node %q: parent key %q not found in plan\", node.Key, parentKey)\n\t\t\t}\n\t\t}\n\t\tfor j, dep := range node.Deps {\n\t\t\tif dep.Target == \"\" {\n\t\t\t\treturn fmt.Errorf(\"node %q: dep %d has empty target\", node.Key, j)\n\t\t\t}\n\t\t\tif dep.Type != \"\" {\n\t\t\t\tdt := types.DependencyType(dep.Type)\n\t\t\t\tif !dt.IsValid() {\n\t\t\t\t\treturn fmt.Errorf(\"node %q: dep %d: invalid dependency type %q\", node.Key, j, dep.Type)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfor i, edge := range plan.Edges {\n\t\tif edge.FromKey != \"\" && !seenKeys[edge.FromKey] {\n\t\t\treturn fmt.Errorf(\"edge %d: from key %q not found in plan\", i, edge.FromKey)\n\t\t}\n\t\tif edge.ToKey != \"\" && !seenKeys[edge.ToKey] {\n\t\t\treturn fmt.Errorf(\"edge %d: to key %q not found in plan\", i, edge.ToKey)\n\t\t}\n\t\tif edge.FromKey == \"\" && edge.FromID == \"\" {\n\t\t\treturn fmt.Errorf(\"edge %d: must specify from_key or from_id\", i)\n\t\t}\n\t\tif edge.ToKey == \"\" && edge.ToID == \"\" {\n\t\t\treturn fmt.Errorf(\"edge %d: must specify to_key or to_id\", i)\n\t\t}","sourceCodeStart":568,"sourceCodeEnd":604,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/graph_apply.go#L568-L604","documentation":"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.","triggerScenarios":"`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).","commonSituations":"Typos or casing mistakes in type names; using types from a different tool's vocabulary; older plans written against a removed type name.","solutions":["Replace the type with a valid dependency type string","Omit the type field entirely if the default type is acceptable","Check the valid dependency type list in the types package for exact spelling"],"exampleFix":"// before\n{\"deps\": [{\"type\": \"related-to\", \"target\": \"build\"}]}\n// after\n{\"deps\": [{\"type\": \"relates-to\", \"target\": \"build\"}]}","handlingStrategy":"validation","validationCode":"valid := map[string]bool{\"blocks\": true, \"related\": true /* plus other valid types */}\nfor _, n := range plan.Nodes {\n\tfor _, d := range n.Deps {\n\t\tif d.Type != \"\" && !valid[d.Type] { return fmt.Errorf(\"invalid dep type %q\", d.Type) }\n\t}\n}","typeGuard":null,"tryCatchPattern":"if err := bd.GraphApply(ctx, plan, opts); err != nil {\n\tif strings.Contains(err.Error(), \"invalid dependency type\") {\n\t\t// correct the type string and retry\n\t}\n}","preventionTips":["Use named constants/enums for dependency types instead of raw strings","Keep a reference list of valid dependency types handy","Normalize casing before assigning dep.Type"],"tags":["validation","graph-apply","invalid-enum-value"],"backgroundTag":"invalid-enum-value","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}