{"record":{"id":"acd6243af3cec0d3","repo":"gastownhall/beads","slug":"unable-to-find-orphaned-issues-w","errorCode":null,"errorMessage":"unable to find orphaned issues: %w","messagePattern":"unable to find orphaned issues: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/orphans.go","lineNumber":196,"sourceCode":"\tif store != nil {\n\t\treturn &doltStoreProvider{labels: labels, labelsAny: labelsAny}, func() {}, nil\n\t}\n\treturn nil, nil, fmt.Errorf(\"no database available\")\n}\n\n// getIssueProvider returns an IssueProvider backed by the global Dolt store.\n// labels and labelsAny are passed through to SearchIssues for label filtering.\nfunc getIssueProvider(labels, labelsAny []string) (types.IssueProvider, func(), error) {\n\treturn getIssueProviderFn(labels, labelsAny)\n}\n\n// findOrphanedIssues wraps the shared doctor package function and converts to output format.\n// It respects the --db flag for cross-repo orphan detection.\n// labels and labelsAny are passed to the issue provider to restrict which issues are considered.\nfunc findOrphanedIssues(path string, labels, labelsAny []string) ([]orphanIssueOutput, error) {\n\tprovider, cleanup, err := getIssueProvider(labels, labelsAny)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to find orphaned issues: %w\", err)\n\t}\n\tdefer cleanup()\n\n\treturn findOrphanedIssuesWithProvider(path, provider)\n}\n\nfunc findOrphanedIssuesWithProvider(path string, provider types.IssueProvider) ([]orphanIssueOutput, error) {\n\torphans, err := doctorFindOrphanedIssues(path, provider)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to find orphaned issues: %w\", err)\n\t}\n\n\tvar output []orphanIssueOutput\n\tfor _, orphan := range orphans {\n\t\toutput = append(output, orphanIssueOutput{\n\t\t\tIssueID:             orphan.IssueID,\n\t\t\tTitle:               orphan.Title,\n\t\t\tStatus:              orphan.Status,","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/orphans.go#L178-L214","documentation":"findOrphanedIssues first obtains an IssueProvider via getIssueProvider; any failure there is wrapped as 'unable to find orphaned issues: %w'. Most commonly the wrapped cause is 'no database available', but any provider-construction failure surfaces under this message.","triggerScenarios":"getIssueProvider returns an error inside findOrphanedIssues — i.e. the global store is nil or the provider factory fails — when called from runConventionsOrphans, tests, or anonymous callers of 'bd orphans'/'bd doctor'.","commonSituations":"'bd orphans' or 'bd doctor conventions orphans' executed without an open database, with a bad --db path, or in an environment where the Dolt store couldn't start.","solutions":["Fix the wrapped cause (typically 'no database available'): run in a repo with an initialized beads DB or pass --db.","Run 'bd init' to create a database if missing.","Verify Dolt/driver health with 'bd doctor'.","For proxied mode, confirm the server opened its store before proxying the orphans call."],"exampleFix":"// before\nbd doctor conventions orphans   # no DB open -> unable to find orphaned issues: no database available\n// after\nbd init && bd doctor conventions orphans","handlingStrategy":"validation","validationCode":"if _, err := os.Stat(filepath.Join(path, \".beads\")); err != nil {\n    return fmt.Errorf(\"no beads database at %s: %w\", path, err)\n}\n// then call findOrphanedIssues","typeGuard":null,"tryCatchPattern":"orphans, err := findOrphanedIssues(path, labels, labelsAny)\nif err != nil {\n    var inner error\n    if errors.As(err, &inner) && strings.Contains(inner.Error(), \"no database available\") {\n        // initialize/open the DB, then retry\n    }\n    return err\n}","preventionTips":["Verify the beads DB exists at the target path before scanning","Run bd init for fresh repos","Check Dolt health via bd doctor","Handle the wrapped cause, not just the wrapper message"],"tags":["go","orphans","database","cli"],"backgroundTag":"no-database-available","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}