{"record":{"id":"2e2dd456130a7d3f","repo":"gastownhall/beads","slug":"errnotfound-2e2dd4","errorCode":"ErrNotFound","errorMessage":"create: dependencies could not be created: %s: %w","messagePattern":"create: dependencies could not be created: (.+?): %w","errorType":"validation","errorClass":"storage.ErrNotFound","httpStatus":null,"severity":"error","filePath":"internal/storage/issueops/execution.go","lineNumber":128,"sourceCode":"\t}\n\treturn publicops.CreateResult{Issue: hydrated}, tables, nil\n}\n\n// skippedDependency records an edge the batch engine declined to write.\ntype skippedDependency struct{ issueID, dependsOnID, reason string }\n\n// skippedDependencyError refuses a guarded create whose requested edges were\n// not all written. The batch engine drops a dangling edge so a partial import\n// still lands, but a guarded create that reported success while silently\n// discarding a parent, waits-for, or explicit dependency is data loss: the\n// caller has no way to learn the relationship is missing. Refusing rolls the\n// whole create back with the enclosing transaction.\nfunc skippedDependencyError(skipped []skippedDependency) error {\n\tedges := make([]string, 0, len(skipped))\n\tfor _, edge := range skipped {\n\t\tedges = append(edges, fmt.Sprintf(\"%s -> %s (%s)\", edge.issueID, edge.dependsOnID, edge.reason))\n\t}\n\treturn fmt.Errorf(\"create: dependencies could not be created: %s: %w\", strings.Join(edges, \"; \"), storage.ErrNotFound)\n}\n\n// ExecuteUpdate applies a guarded update in tx and reports durable tables changed.\nfunc ExecuteUpdate(ctx context.Context, tx *sql.Tx, request publicops.UpdateRequest) (publicops.UpdateResult, ChangedTables, error) {\n\tattempt := CloneUpdateRequest(request)\n\tif attempt.Actor == \"\" || attempt.IssueID == \"\" {\n\t\treturn publicops.UpdateResult{}, nil, fmt.Errorf(\"%w: update requires actor and issue ID\", storage.ErrValidation)\n\t}\n\tif err := ValidateUpdateRequest(attempt); err != nil {\n\t\treturn publicops.UpdateResult{}, nil, err\n\t}\n\tif err := ValidateMetadataPatch(attempt.Patch.Metadata); err != nil {\n\t\treturn publicops.UpdateResult{}, nil, err\n\t}\n\t// The plane restriction is resolved HERE, inside the update's own\n\t// transaction, so a caller that serves durable issues only cannot be handed\n\t// a wisp by a resolve that ran earlier.\n\tif attempt.IssuePlaneOnly && IsActiveWispInTx(ctx, tx, attempt.IssueID) {","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/issueops/execution.go#L110-L146","documentation":"ExecuteCreate/ExecuteCreateBatch skip dependencies that cannot be resolved (e.g. the depends-on issue does not exist or is unreachable on the caller's plane) instead of failing the whole batch silently. If any were skipped, the entire create is rolled back and this error, wrapping storage.ErrNotFound, lists each skipped edge as \"issueID -> dependsOnID (reason)\". The transaction is aborted so the create never partially lands.","triggerScenarios":"Calling ExecuteCreate or ExecuteCreateBatch with a request whose Dependencies reference issue IDs that do not exist, were closed/deleted, or are wisps invisible to a durable-only plane caller.","commonSituations":"Typo'd or stale issue IDs in a --depends-on flag; referencing issues living in a different database/remote; batch creates generated from scripts with hard-coded IDs; wisp/durable plane mismatch after switching storage modes.","solutions":["Read the edge list in the message, verify each depends-on ID exists (bd show <id>), and correct or drop the bad IDs.","Create missing dependency issues first, then re-run the create.","If the dependency is a wisp and you require durable issues, recreate it as a durable issue or drop the edge.","Re-run the create; the original transaction was rolled back so nothing was written."],"exampleFix":"// before\nbd create \"Task\" --depends-on=bd-9999 // bd-9999 does not exist\n// after\nbd show bd-9999 || bd create \"Dependency\" # then use the real ID\nbd create \"Task\" --depends-on=bd-1000","handlingStrategy":"validation","validationCode":"for _, depID := range req.Dependencies {\n\tif _, err := GetIssueInTx(ctx, tx, depID); err != nil {\n\t\treturn fmt.Errorf(\"dependency %s does not exist: %w\", depID, err)\n\t}\n}","typeGuard":null,"tryCatchPattern":"_, _, err := ExecuteCreateBatch(ctx, tx, batch)\nif errors.Is(err, storage.ErrNotFound) && strings.Contains(err.Error(), \"dependencies could not be created\") {\n\tskipped := parseSkippedEdges(err.Error()) // \"id -> depId (reason)\"\n\treturn fmt.Errorf(\"fix or drop these dependency edges, then retry: %v\", skipped)\n}","preventionTips":["Resolve every --depends-on ID with `bd show` before creating issues that reference them.","Create dependency issues before the dependent issue in scripts.","Use a shared ID source (fresh `bd list` output) rather than hard-coded IDs in automation.","Match issue plane: don't reference wisps from durable-only callers."],"tags":["dependencies","not-found","create","transaction"],"backgroundTag":"dependency-not-found","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}