{"record":{"id":"9afa684e05ae663e","repo":"gastownhall/beads","slug":"getting-open-issues-w","errorCode":null,"errorMessage":"getting open issues: %w","messagePattern":"getting open issues: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/doctor/git.go","lineNumber":882,"sourceCode":"//   - provider: The issue provider to get open issues and prefix from\nfunc FindOrphanedIssues(gitPath string, provider types.IssueProvider) ([]OrphanIssue, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), gitCmdTimeout)\n\tdefer cancel()\n\n\t// Skip if not in a git repo\n\tcmd := exec.CommandContext(ctx, \"git\", \"rev-parse\", \"--git-dir\")\n\tcmd.Dir = gitPath\n\tif err := cmd.Run(); err != nil {\n\t\treturn []OrphanIssue{}, nil // Not a git repo, return empty list\n\t}\n\n\t// Get issue prefix from provider\n\tissuePrefix := provider.GetIssuePrefix()\n\n\t// Get all open/in_progress issues from provider\n\tissues, err := provider.GetOpenIssues(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"getting open issues: %w\", err)\n\t}\n\n\topenIssues := make(map[string]*OrphanIssue)\n\tfor _, issue := range issues {\n\t\topenIssues[issue.ID] = &OrphanIssue{\n\t\t\tIssueID: issue.ID,\n\t\t\tTitle:   issue.Title,\n\t\t\tStatus:  string(issue.Status),\n\t\t}\n\t}\n\n\tif len(openIssues) == 0 {\n\t\treturn []OrphanIssue{}, nil\n\t}\n\n\t// Get git log\n\tcmd = exec.CommandContext(ctx, \"git\", \"log\", \"--oneline\", \"--all\")\n\tcmd.Dir = gitPath","sourceCodeStart":864,"sourceCodeEnd":900,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/doctor/git.go#L864-L900","documentation":"FindOrphanedIssues asks the configured issue provider for all open/in-progress issues to cross-reference them against git history. If provider.GetOpenIssues(ctx) returns an error, it is wrapped as \"getting open issues: %w\". The failure means bd could not enumerate open issues at all, so orphan detection cannot proceed — the underlying cause is always in the wrapped provider error.","triggerScenarios":"Calling FindOrphanedIssues when the issue store (local Dolt DB via the provider) is unavailable, the database is missing or corrupt, the context is cancelled before/during the query, or the provider's query against open issues fails for schema/connection reasons.","commonSituations":"Running `bd doctor` orphan checks without a Dolt server running; running in a directory with no initialized .beads database; the issues database was cloned without history or has a schema mismatch after upgrading bd; the command's context times out on a very large issue set.","solutions":["Look at the wrapped error: fix the underlying provider failure it describes (usually connection or database-missing).","Ensure the Dolt server is running and `bd list` works before re-running orphan detection.","If the DB is missing/uninitialized, run `bd init` or restore .beads from the git-tracked export.","If cancelled/timed out, re-run with a longer deadline or check network/remote sync health."],"exampleFix":"// before\n$ bd doctor --check orphans\ngetting open issues: dolt server not reachable: dial tcp ...: connect: connection refused\n\n// after\n$ bd dolt server &\n$ bd doctor --check orphans\nno orphaned issues found","handlingStrategy":"try-catch","validationCode":"if err := doltReachable(); err != nil {\n\treturn fmt.Errorf(\"skip orphan check: issue store unavailable: %w\", err)\n}\nif _, err := os.Stat(\".beads\"); os.IsNotExist(err) {\n\treturn fmt.Errorf(\"no .beads database in this directory; run bd init\")\n}","typeGuard":null,"tryCatchPattern":"issues, err := FindOrphanedIssues(ctx, provider, gitPath)\nif err != nil {\n\tif strings.HasPrefix(err.Error(), \"getting open issues\") {\n\t\t// provider/store failure — check Dolt server and bd list first\n\t}\n\treturn fmt.Errorf(\"orphan check unavailable: %w\", err)\n}","preventionTips":["Verify `bd list` succeeds before running orphan detection.","Keep the Dolt server running and synced (`bd dolt pull`).","Initialize the database with `bd init` in every working clone.","Pass a generous context deadline for large issue sets."],"tags":["doctor","issues","provider","wrapped-error"],"backgroundTag":"issue-provider-query-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}