{"record":{"id":"5d79a1798693db10","repo":"gastownhall/beads","slug":"edge-d-invalid-dependency-type-q","errorCode":null,"errorMessage":"edge %d: invalid dependency type %q","messagePattern":"edge (.+?): invalid dependency type %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/graph_apply.go","lineNumber":608,"sourceCode":"\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}\n\t\tif edge.Type != \"\" {\n\t\t\tdt := types.DependencyType(edge.Type)\n\t\t\tif !dt.IsValid() {\n\t\t\t\treturn fmt.Errorf(\"edge %d: invalid dependency type %q\", i, edge.Type)\n\t\t\t}\n\t\t}\n\t\tif edge.Gate != \"\" || edge.SpawnerKey != \"\" || edge.SpawnerID != \"\" {\n\t\t\tif graphApplyDependencyType(edge.Type) != types.DepWaitsFor {\n\t\t\t\treturn fmt.Errorf(\"edge %d: gate/spawner fields require type %q\", i, types.DepWaitsFor)\n\t\t\t}\n\t\t\tif edge.Gate != \"\" && !types.IsValidWaitsForGate(edge.Gate) {\n\t\t\t\treturn fmt.Errorf(\"edge %d: invalid gate %q (valid: %s, %s)\", i, edge.Gate, types.WaitsForAllChildren, types.WaitsForAnyChildren)\n\t\t\t}\n\t\t\tif edge.SpawnerKey != \"\" && edge.SpawnerID != \"\" {\n\t\t\t\treturn fmt.Errorf(\"edge %d: cannot specify both spawner_key and spawner_id\", i)\n\t\t\t}\n\t\t\tif edge.SpawnerKey != \"\" && !seenKeys[edge.SpawnerKey] {\n\t\t\t\treturn fmt.Errorf(\"edge %d: spawner key %q not found in plan\", i, edge.SpawnerKey)\n\t\t\t}\n\t\t\t// Gate evaluation reads the spawner from the dependency target\n\t\t\t// (depends_on_id), not metadata, so the spawner must equal the to\n\t\t\t// endpoint. Since to_id overrides to_key at apply time","sourceCodeStart":590,"sourceCodeEnd":626,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/graph_apply.go#L590-L626","documentation":"`bd graph apply` validates each edge's dependency type against the known DependencyType enum. If edge.type is non-empty but is not a valid dependency type, the plan is rejected with this error so invalid dependency semantics never reach storage.","triggerScenarios":"An edge in a graph plan has a type string that is not one of the valid dependency types (e.g. \"depends\" instead of \"discovers-from\", misspelling, wrong casing).","commonSituations":"Typo in plan type field; copying a type name from another issue tracker; generating plans with stale type names after a vocabulary change.","solutions":["Check `bd dep types` (or docs) for the exact valid dependency type names and correct edge.type","Remove edge.type entirely if the default type is acceptable","Re-generate the plan from the source tool with corrected type names"],"exampleFix":"// before\n{\"from_key\": \"a\", \"to_key\": \"b\", \"type\": \"blocks\"}\n// after\n{\"from_key\": \"a\", \"to_key\": \"b\", \"type\": \"blocks\"} (use a valid type, e.g. \"blocks\" / \"related\" / \"discovered-from\")","handlingStrategy":"validation","validationCode":"valid := map[string]bool{\"blocks\":true,\"related\":true,\"parent-child\":true,\"discovered-from\":true,\"waits-for\":true} // check bd dep types for exact list\nif e.Type != \"\" && !valid[e.Type] { return fmt.Errorf(\"edge type %q invalid\", e.Type) }","typeGuard":"func validDepType(t string) bool { return t == \"\" || types.DependencyType(t).IsValid() }","tryCatchPattern":null,"preventionTips":["Copy type names from documentation, never from memory","Centralize type constants in your plan generator","Lint plans for known enum fields before apply"],"tags":["graph-plan","validation","dependency-type"],"backgroundTag":"invalid-dependency-type","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}