{"record":{"id":"2412760851c71511","repo":"gastownhall/beads","slug":"getissuesbyids-w","errorCode":null,"errorMessage":"GetIssuesByIDs: %w","messagePattern":"GetIssuesByIDs: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/export_auto.go","lineNumber":1098,"sourceCode":"\t\t\treturn 0, 0, nil, false, err\n\t\t}\n\t\treturn issueCount, memoryCount, changed.Upserted, true, nil\n\t}\n\tif total > incrementalExportThreshold {\n\t\tdebug.Logf(\"auto-export: %d changes exceeds threshold %d; full export\\n\",\n\t\t\ttotal, incrementalExportThreshold)\n\t\treturn 0, 0, nil, false, nil\n\t}\n\n\t// Fetch fresh data for upserted IDs (including anything carried over\n\t// from last cycle) and apply the same template/infra/owner filters the\n\t// full export uses.\n\tvar records map[string][]byte\n\tdroppedByFilter := make(map[string]bool)\n\tif len(upsertIDs) > 0 {\n\t\tissues, fetchErr := store.GetIssuesByIDs(ctx, upsertIDs)\n\t\tif fetchErr != nil {\n\t\t\treturn 0, 0, nil, false, fmt.Errorf(\"GetIssuesByIDs: %w\", fetchErr)\n\t\t}\n\t\tinfraSet := store.GetInfraTypes(ctx)\n\t\t// Owner-exclusion safety net, mirroring exportToFile's: without\n\t\t// this, a config-excluded owner's issue that changes would leak\n\t\t// into the git-committed JSONL via the incremental path even\n\t\t// though the full-export path always excludes it (be-shbed).\n\t\townerExcludes := buildOwnerExcludeSet(ctx, storeExportSource{}, nil)\n\t\tfiltered := make([]*types.Issue, 0, len(issues))\n\t\tfor _, iss := range issues {\n\t\t\t// Record IDs that GetIssuesByIDs returned but we deliberately\n\t\t\t// filtered out. Those DO need dropping from the export because\n\t\t\t// the full-export path excludes them; leaving a stale record\n\t\t\t// in place would diverge the two outputs.\n\t\t\tif iss.IsTemplate {\n\t\t\t\tdroppedByFilter[iss.ID] = true\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif len(infraSet) > 0 && infraSet[string(iss.IssueType)] {","sourceCodeStart":1080,"sourceCodeEnd":1116,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/export_auto.go#L1080-L1116","documentation":"tryIncrementalExport fetches the issues it needs to upsert via store.GetIssuesByIDs. If the store lookup fails, the incremental path aborts with this wrapped error (and the caller, maybeAutoExport, falls back to a full export). It indicates a storage-layer failure, not a git/file problem.","triggerScenarios":"tryIncrementalExport calls store.GetIssuesByIDs(ctx, upsertIDs) for non-empty upsertIDs and the store returns an error — DB corruption, locked/closed database, driver failure.","commonSituations":"Dolt/database locked by another process; corrupted local store; storage driver errors; transient DB issues during rapid successive bd commands.","solutions":["Retry the sync — maybeAutoExport falls back to a full export path which may succeed","Check the local store health (`bd doctor`) for corruption or lock issues","Close competing bd processes holding the database, then rerun `bd sync`"],"exampleFix":"// before\n// GetIssuesByIDs: database is locked\n// after\nbd doctor   # verify store health\nbd sync     # retries, falling back to full export if needed","handlingStrategy":"fallback","validationCode":"// Check store responsiveness before incremental export\nctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\ndefer cancel()\nif _, err := store.GetIssuesByIDs(ctx, []string{\"smoke-test-id\"}); err != nil && !errors.Is(err, ErrNotFound) {\n    fmt.Println(\"store unhealthy; prefer full export / bd doctor\")\n}","typeGuard":null,"tryCatchPattern":"count, _, _, _, err := tryIncrementalExport(...)\nif err != nil && strings.Contains(err.Error(), \"GetIssuesByIDs:\") {\n    // Fall back to a full export, which rebuilds from a fresh store read\n    fullExport()\n}","preventionTips":["Close competing bd processes before large sync operations","Run `bd doctor` when store errors recur","Avoid killing bd mid-write; let transactions finish","Keep the storage driver and bd versions in sync"],"tags":["storage","database","incremental-export"],"backgroundTag":"store-query-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}