{"record":{"id":"23630b45915d171a","repo":"gastownhall/beads","slug":"failed-to-load-issues-w","errorCode":null,"errorMessage":"failed to load issues: %w","messagePattern":"failed to load issues: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/doctor/maintenance.go","lineNumber":487,"sourceCode":"\t\t\tif len(result.PatrolDigestIDs) < 3 {\n\t\t\t\tresult.PatrolDigestIDs = append(result.PatrolDigestIDs, issue.ID)\n\t\t\t}\n\t\tcase patrolIssueSessionEnded:\n\t\t\tresult.SessionBeadCount++\n\t\t\tif len(result.SessionBeadIDs) < 3 {\n\t\t\t\tresult.SessionBeadIDs = append(result.SessionBeadIDs, issue.ID)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result\n}\n\n// getPatrolPollutionIDs returns all IDs of patrol pollution beads for deletion\nfunc getPatrolPollutionIDs(path string) ([]string, error) {\n\tissues, err := loadMaintenanceIssues(path)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to load issues: %w\", err)\n\t}\n\n\tvar ids []string\n\tfor _, issue := range issues {\n\t\tif issue == nil {\n\t\t\tcontinue\n\t\t}\n\t\tswitch classifyPatrolIssue(issue.Title) {\n\t\tcase patrolIssueDigest, patrolIssueSessionEnded:\n\t\t\tids = append(ids, issue.ID)\n\t\t}\n\t}\n\n\treturn ids, nil\n}\n\n// loadMaintenanceIssues loads issues for maintenance checks.\n// It prefers Dolt (source of truth) and falls back to legacy JSONL for","sourceCodeStart":469,"sourceCodeEnd":505,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/doctor/maintenance.go#L469-L505","documentation":"getPatrolPollutionIDs loads the full issue list via loadMaintenanceIssues to collect patrol-pollution bead IDs for deletion. Any failure from that loader (which itself tries the database then the JSONL export) is wrapped as 'failed to load issues'. Seeing this error means the underlying cause is in the wrapped message (database or JSONL read failure).","triggerScenarios":"loadMaintenanceIssues(path) returns an error — i.e. both the Dolt database read and the .beads/issues.jsonl fallback read failed, and that combined error is wrapped here.","commonSituations":"Running patrol-pollution cleanup in a directory with no initialized bd database; corrupted .beads/issues.jsonl; a Dolt server that is down or misconfigured; wrong --path pointing at a non-bd directory.","solutions":["Read the wrapped cause: it names the database error and the JSONL error; fix that first.","Verify you are pointing at the right repo (.beads directory exists with issues.jsonl).","Run bd doctor to diagnose/repair the database before the pollution cleanup.","If JSONL is corrupt, restore it via bd sync or regenerate it, then retry."],"exampleFix":"// before\n$ bd doctor --fix --path ./wrong-dir\nError: failed to load issues: database read failed: ...; JSONL fallback read failed: no such file\n// after\n$ cd /path/to/repo && bd doctor --fix","handlingStrategy":"fallback","validationCode":"if _, err := os.Stat(filepath.Join(path, \".beads\", \"issues.jsonl\")); err != nil {\n    return fmt.Errorf(\"no bd database at %s: run bd init / bd sync first\", path)\n}","typeGuard":null,"tryCatchPattern":"ids, err := getPatrolPollutionIDs(path)\nif err != nil {\n    var inner error\n    if errors.As(err, &inner) { /* inspect wrapped db/jsonl causes */ }\n    log.Printf(\"skipping patrol cleanup: %v\", err)\n    return nil // degrade gracefully instead of failing the whole run\n}","preventionTips":["Run bd sync before maintenance so both the DB and JSONL are fresh.","Point --path at the directory containing .beads.","Run bd doctor first to repair storage before pollution cleanup.","Keep the dolt CLI installed and current."],"tags":["database","jsonl","loading"],"backgroundTag":"issue-load-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}