{"record":{"id":"f9e59cb9ac9b8ffa","repo":"gastownhall/beads","slug":"applygraph-read-existing-deps-for-s-w","errorCode":null,"errorMessage":"applyGraph: read existing deps for %s: %w","messagePattern":"applyGraph: read existing deps for (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/domain/issue.go","lineNumber":1533,"sourceCode":"\t\t}\n\t\tif seen[id] {\n\t\t\treturn false, nil\n\t\t}\n\t\tseen[id] = true\n\t\tfor _, next := range adj[id] {\n\t\t\tfound, err := visit(next)\n\t\t\tif err != nil || found {\n\t\t\t\treturn found, err\n\t\t\t}\n\t\t}\n\t\tdeps, ok := depCache[id]\n\t\tif !ok {\n\t\t\tregular, err := u.depRepo.ListByIssueIDs(ctx, []string{id}, DepListOpts{\n\t\t\t\tDirection:     DepDirectionOut,\n\t\t\t\tUseWispsTable: false,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn false, fmt.Errorf(\"applyGraph: read existing deps for %s: %w\", id, err)\n\t\t\t}\n\t\t\twisp, err := u.depRepo.ListByIssueIDs(ctx, []string{id}, DepListOpts{\n\t\t\t\tDirection:     DepDirectionOut,\n\t\t\t\tUseWispsTable: true,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn false, fmt.Errorf(\"applyGraph: read existing wisp deps for %s: %w\", id, err)\n\t\t\t}\n\t\t\tdeps = append(regular.Outgoing[id], wisp.Outgoing[id]...)\n\t\t\tdepCache[id] = deps\n\t\t}\n\t\tfor _, dep := range deps {\n\t\t\tif !followExistingDep(dep.Type) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfound, err := visit(dep.DependsOnID)\n\t\t\tif err != nil || found {\n\t\t\t\treturn found, err","sourceCodeStart":1515,"sourceCodeEnd":1551,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/domain/issue.go#L1515-L1551","documentation":"Wraps a failure from depRepo.ListByIssueIDs (regular dependencies table) while graphHasPath lazily loads a node's existing outgoing deps during dependency-graph cycle detection. The underlying store/query error is chained as %w. Thrown during ApplyGraph when the walk visits a node not yet in the dep cache.","triggerScenarios":"ApplyGraph cycle-check walk reaches a node whose outgoing deps are not cached and the non-wisp ListByIssueIDs query fails (DB unavailable, bad connection, storage driver error, corrupted deps table, context canceled).","commonSituations":"Dolt/database process down mid-command; network partition to remote Dolt; ctx deadline exceeded on very large dependency graphs; table schema drift after version upgrade.","solutions":["Check database connectivity and retry the bd command (transient driver errors often clear).","Inspect the wrapped %w error for the concrete storage error; fix storage-level cause (e.g. restart dolt server).","Verify deps table schema matches the expected version (bd doctor / driver migration).","Reduce graph size or raise context timeout if deadline-exceeded."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// ensure the issue id is resolvable before applying the graph\nif id == \"\" {\n    return fmt.Errorf(\"graph node id is empty\")\n}\nif err := ctx.Err(); err != nil {\n    return err\n}","typeGuard":null,"tryCatchPattern":"if err != nil {\n    var retryable bool\n    if errors.Is(err, context.DeadlineExceeded) || errors.Is(err, driver.ErrUnavailable) {\n        retryable = true\n    }\n    return fmt.Errorf(\"applyGraph: read existing deps for %s: %w (retryable=%v)\", id, err, retryable)\n}","preventionTips":["Keep DB connection healthy before bulk graph operations (bd doctor).","Use adequate context timeouts for large dependency graphs.","Retry transient driver errors with backoff.","Keep bd version and DB schema in sync."],"tags":["storage","dependency-graph","database"],"backgroundTag":"dependency-list-query-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}