{"record":{"id":"a1a7bfd573771b19","repo":"gastownhall/beads","slug":"load-dependency-records-w","errorCode":null,"errorMessage":"load dependency records: %w","messagePattern":"load dependency records: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/export_source.go","lineNumber":289,"sourceCode":"\tif err != nil {\n\t\tif !dberrors.IsTableNotExist(err) {\n\t\t\treturn exportRelations{}, fmt.Errorf(\"load wisp comments: %w\", err)\n\t\t}\n\t} else {\n\t\tmergeExportMap(rel.comments, wispComments)\n\t}\n\twispCounts, err := s.uw.CommentUseCase().GetWispCommentCounts(ctx, allIDs)\n\tif err != nil {\n\t\tif !dberrors.IsTableNotExist(err) {\n\t\t\treturn exportRelations{}, fmt.Errorf(\"load wisp comment counts: %w\", err)\n\t\t}\n\t} else {\n\t\tmergeExportMap(rel.commentCounts, wispCounts)\n\t}\n\n\tdeps, err := s.uw.DependencyUseCase().GetIssueDependencyRecords(ctx, allIDs)\n\tif err != nil {\n\t\treturn exportRelations{}, fmt.Errorf(\"load dependency records: %w\", err)\n\t}\n\trel.deps = deps\n\n\tdepCounts, err := s.uw.DependencyUseCase().CountsByIssueIDs(ctx, allIDs)\n\tif err != nil {\n\t\treturn exportRelations{}, fmt.Errorf(\"load dependency counts: %w\", err)\n\t}\n\trel.depCounts = depCounts\n\twispDepCounts, err := s.uw.DependencyUseCase().CountsByWispIDs(ctx, allIDs)\n\tif err != nil {\n\t\t// A rig without the wisp tables simply has no wisp-plane edges.\n\t\tif !dberrors.IsTableNotExist(err) {\n\t\t\treturn exportRelations{}, fmt.Errorf(\"load wisp dependency counts: %w\", err)\n\t\t}\n\t} else {\n\t\tfor id, wc := range wispDepCounts {\n\t\t\tif wc == nil || (wc.DependencyCount == 0 && wc.DependentCount == 0) {\n\t\t\t\tcontinue","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/export_source.go#L271-L307","documentation":"This error wraps a failure from `DependencyUseCase().GetIssueDependencyRecords(ctx, allIDs)` when loading dependency edges for the issues being exported. Unlike the wisp-plane loaders, there is no table-not-exist tolerance here: dependencies are core-plane data, so any error aborts the export.","triggerScenarios":"Calling LoadExportRelations when the dependency-records query fails: dependencies table missing/corrupt, Dolt connection failure, SQL error, or context cancellation.","commonSituations":"A database created before the dependencies schema existed; a corrupt dependencies table after a crashed migration; `bd export` against a down or misconfigured Dolt backend; export cancelled by timeout.","solutions":["Check the wrapped cause; fix the underlying storage connectivity or restart the Dolt server","Run `bd doctor` and schema migrations — a missing/corrupt dependencies table is serious and will also break other commands","If dependencies are truly absent (fresh DB), verify whether the driver's error is a table-not-exist case that upstream should tolerate; otherwise re-initialize the database","Re-run the export once the backend is healthy"],"exampleFix":"// before: any dependency-load error kills the export\ndeps, err := s.uw.DependencyUseCase().GetIssueDependencyRecords(ctx, allIDs)\nif err != nil { return exportRelations{}, fmt.Errorf(\"load dependency records: %w\", err) }\n// after: tolerate a genuinely absent table on legacy DBs\ndeps, err := s.uw.DependencyUseCase().GetIssueDependencyRecords(ctx, allIDs)\nif err != nil {\n    if !dberrors.IsTableNotExist(err) { return exportRelations{}, fmt.Errorf(\"load dependency records: %w\", err) }\n    deps = nil\n}","handlingStrategy":"try-catch","validationCode":"// dependencies are core-plane; confirm the table exists via doctor or a probe query before export\nif err := store.PingContext(ctx); err != nil {\n    return fmt.Errorf(\"storage backend unreachable: %w\", err)\n}","typeGuard":"func isTableNotExist(err error) bool { return dberrors.IsTableNotExist(err) }","tryCatchPattern":"deps, err := s.uw.DependencyUseCase().GetIssueDependencyRecords(ctx, allIDs)\nif err != nil {\n    return fmt.Errorf(\"load dependency records: %w\", err)\n}","preventionTips":["Run `bd doctor` to catch missing/corrupt dependencies tables before exporting","Keep migrations up to date after upgrading beads","Ensure the Dolt backend is running and reachable for the whole export","Increase context timeouts for exports over large issue sets"],"tags":["go","export","dependencies","dolt","storage"],"backgroundTag":"database-query-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}