{"record":{"id":"aecbb7d4dbca3e5d","repo":"gastownhall/beads","slug":"failed-to-update-gate-with-discovered-run-id-w","errorCode":null,"errorMessage":"failed to update gate with discovered run ID: %w","messagePattern":"failed to update gate with discovered run ID: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/gate.go","lineNumber":1042,"sourceCode":"\t}\n\n\t// If await_id is a workflow name hint (non-numeric), auto-discover the run ID\n\tif !isNumericID(gate.AwaitID) {\n\t\tvar discoveredID string\n\t\tvar discoverErr error\n\t\tif repo == \"\" {\n\t\t\tdiscoveredID, discoverErr = discoverRunIDByWorkflowNameFunc(gate.AwaitID)\n\t\t} else {\n\t\t\tdiscoveredID, discoverErr = discoverRunIDByWorkflowNameInRepoWithRunner(gate.AwaitID, repo, runGH)\n\t\t}\n\t\tif discoverErr != nil {\n\t\t\treturn false, false, fmt.Sprintf(\"workflow hint '%s': %v\", gate.AwaitID, discoverErr), nil\n\t\t}\n\n\t\tif persistAwaitID != nil {\n\t\t\t// Non-dry-run flows persist the numeric run ID for future checks.\n\t\t\tif updateErr := persistAwaitID(gate.ID, discoveredID); updateErr != nil {\n\t\t\t\treturn false, false, \"\", fmt.Errorf(\"failed to update gate with discovered run ID: %w\", updateErr)\n\t\t\t}\n\t\t}\n\n\t\trunID = discoveredID\n\t}\n\n\tif repo == \"\" {\n\t\treturn checkGHRunStatusFunc(runID)\n\t}\n\treturn checkGHRunStatusInRepoWithRunner(runID, repo, runGH)\n}\n\nfunc checkGHRunStatus(runID string) (resolved, escalated bool, reason string, err error) {\n\treturn checkGHRunStatusInRepo(runID, \"\")\n}\n\nfunc checkGHRunStatusInRepo(runID, repo string) (resolved, escalated bool, reason string, err error) {\n\treturn checkGHRunStatusInRepoWithRunner(runID, repo, runGHCommand)","sourceCodeStart":1024,"sourceCodeEnd":1060,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/gate.go#L1024-L1060","documentation":"Wraps the storage error returned when persisting the auto-discovered numeric run ID back onto the gate (cmd/bd/gate.go:1042). Discovery succeeded, but the persistAwaitID callback (a database update of the gate's await_id) failed, so the numeric ID is not cached for future checks.","triggerScenarios":"checkGHRunWithRunner resolves a workflow-name hint, then calls persistAwaitID(gate.ID, discoveredID) during a non-dry-run flow, and the underlying DB update returns an error (store closed, locked, concurrent modification, or write failure).","commonSituations":"Dolt/database connection dropped mid-operation, another process holds a conflicting write to the same issue, gate was deleted between read and update, disk or migration error in the beads store.","solutions":["Check the wrapped cause (%w) for the storage-layer error message","Confirm the gate still exists: `bd show <gate-id>`","Retry the gate check — persistence is retried on the next evaluation","Verify database connectivity and that no other process holds a conflicting write"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if _, _, _, err := checkGHRun(gate); err != nil && strings.Contains(err.Error(), \"failed to update gate with discovered run ID\") {\n    // persistence failed; the check itself may still succeed — retry or log and continue\n}","preventionTips":["Keep the beads DB connection healthy and migrations applied","Avoid concurrent writers to the same gate issue","Ensure the gate still exists before evaluation flows that persist"],"tags":["database","persistence","gate"],"backgroundTag":"database-write-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}