{"record":{"id":"5bc5b177e86b7b1d","repo":"gastownhall/beads","slug":"getting-ready-work-w","errorCode":null,"errorMessage":"getting ready work: %w","messagePattern":"getting ready work: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/mol_ready_gated.go","lineNumber":150,"sourceCode":"\tclosedStatus := types.StatusClosed\n\tgateFilter := types.IssueFilter{\n\t\tIssueType: &gateType,\n\t\tStatus:    &closedStatus,\n\t}\n\n\tclosedGates, err := s.SearchIssues(ctx, \"\", gateFilter)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"searching closed gates: %w\", err)\n\t}\n\n\tif len(closedGates) == 0 {\n\t\treturn nil, nil\n\t}\n\n\t// Step 2: Get ready work to check which steps are ready\n\treadyIssues, err := s.GetReadyWork(ctx, types.WorkFilter{})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"getting ready work: %w\", err)\n\t}\n\treadyIDs := make(map[string]bool)\n\tfor _, issue := range readyIssues {\n\t\treadyIDs[issue.ID] = true\n\t}\n\n\t// Step 3: Get hooked molecules to filter out\n\thookedStatus := types.StatusHooked\n\thookedFilter := types.IssueFilter{\n\t\tStatus: &hookedStatus,\n\t}\n\thookedIssues, err := s.SearchIssues(ctx, \"\", hookedFilter)\n\tif err != nil {\n\t\t// Non-fatal: just continue without filtering\n\t\thookedIssues = nil\n\t}\n\t// Batch-find parent molecules for hooked issues (bd-hn4q)\n\thookedMolecules := make(map[string]bool)","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/mol_ready_gated.go#L132-L168","documentation":"After collecting closed gates, findGateReadyMolecules calls GetReadyWork to learn which issue IDs are currently ready. A failure there is wrapped as 'getting ready work: %w', meaning the ready-work computation in the storage layer (dependency/status evaluation) errored.","triggerScenarios":"Running bd mol ready when GetReadyWork fails: database unavailable, dependency-graph query error, or proxied server returning an error for the ready-work endpoint.","commonSituations":"Corrupt dependency rows after interrupted sync; Dolt server down during proxied operation; large dependency graphs hitting query timeouts.","solutions":["Inspect the wrapped cause for the actual GetReadyWork failure and address it (connection, corruption, timeout)","Run bd doctor to validate database integrity","If proxied, restart or reconnect to the bd daemon and retry","Retry the command once storage is healthy"],"exampleFix":"// before\nreadyIssues, err := s.GetReadyWork(ctx, types.WorkFilter{})\nif err != nil {\n    return nil, fmt.Errorf(\"getting ready work: %w\", err)\n}\n// after: fail fast with context for callers/agents\nreadyIssues, err := s.GetReadyWork(ctx, types.WorkFilter{})\nif err != nil {\n    return nil, fmt.Errorf(\"getting ready work for gate check: %w\", err)\n}","handlingStrategy":"try-catch","validationCode":"// Pre-check storage health before computing ready work\nif err := s.SearchIssues(ctx, \"\", types.IssueFilter{Limit: ptr(1)}); err != nil {\n    return fmt.Errorf(\"storage unavailable: %w\", err)\n}","typeGuard":"func storageOK(s molStore) bool { return s != nil }","tryCatchPattern":"ready, err := findGateReadyMolecules(ctx, s, gateType)\nif err != nil {\n    if strings.Contains(err.Error(), \"getting ready work\") {\n        log.Printf(\"ready-work query failed: %v\", errors.Unwrap(err))\n    }\n    return err\n}","preventionTips":["Keep dependency graph clean; run bd doctor to detect corrupt deps","Avoid running concurrent writers against the same Dolt DB","Retry transient storage errors with backoff in automation"],"tags":["go","storage","dolt","ready-work"],"backgroundTag":"ready-work-query-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}