{"record":{"id":"f1d2c2ab7e898354","repo":"gastownhall/beads","slug":"journal-iterate-derived-is-blocked-from-s-w","errorCode":null,"errorMessage":"journal: iterate derived is_blocked from %s: %w","messagePattern":"journal: iterate derived is_blocked from (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/issueops/journal.go","lineNumber":246,"sourceCode":"\t\t\t\targs...)\n\t\t\tif err != nil {\n\t\t\t\tif optionalBlockedTable(target.table) && isTableNotExistError(err) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\treturn nil, fmt.Errorf(\"journal: snapshot derived is_blocked from %s: %w\", target.table, err)\n\t\t\t}\n\t\t\tfor rows.Next() {\n\t\t\t\tvar id string\n\t\t\t\tvar blocked int\n\t\t\t\tif err := rows.Scan(&id, &blocked); err != nil {\n\t\t\t\t\t_ = rows.Close()\n\t\t\t\t\treturn nil, fmt.Errorf(\"journal: scan derived is_blocked from %s: %w\", target.table, err)\n\t\t\t\t}\n\t\t\t\tsnapshot[blockedJournalKey{table: target.table, id: id}] = blocked != 0\n\t\t\t}\n\t\t\tif err := rows.Err(); err != nil {\n\t\t\t\t_ = rows.Close()\n\t\t\t\treturn nil, fmt.Errorf(\"journal: iterate derived is_blocked from %s: %w\", target.table, err)\n\t\t\t}\n\t\t\tif err := rows.Close(); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"journal: close derived is_blocked from %s: %w\", target.table, err)\n\t\t\t}\n\t\t}\n\t}\n\treturn snapshot, nil\n}\n\n// recordBlockedJournalChanges compares the stable post-maintenance state with\n// the captured state and journals only beads whose derived is_blocked value\n// actually changed. The emitted update carries the complete post-mutation\n// snapshot, allowing a cursor consumer to stay correct without graph queries.\nfunc recordBlockedJournalChanges(\n\tctx context.Context,\n\ttx DBTX,\n\tbefore blockedJournalSnapshot,\n\tissueIDs, wispIDs []string,","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/issueops/journal.go#L228-L264","documentation":"After scanning all rows, rows.Err() reported an iteration-level failure (driver/connection error mid-result-set). The wrapper aborts the journal snapshot and fails the transaction.","triggerScenarios":"Connection dropped or the underlying SQL session errored while streaming rows of the is_blocked snapshot SELECT.","commonSituations":"Network interruption to the Dolt/SQL server; server-side query kill/timeout; connection pool closure during long IN (...) queries with many ids.","solutions":["Inspect the wrapped driver error","Retry the operation; if transient, it should succeed","Reduce the id-list size / batch the IN clause to shorten result streaming","Check server logs and connection stability"],"exampleFix":"null","handlingStrategy":"retry","validationCode":"if err := db.Ping(); err != nil { /* reconnect before starting the transaction */ }","typeGuard":"null","tryCatchPattern":"for attempt := 0; attempt < 3; attempt++ {\n  snap, err := runRecomputeTx(ctx)\n  if err == nil { break }\n  if !isTransient(err) { return err }\n  time.Sleep(backoff(attempt))\n}","preventionTips":["Keep the IN (...) id lists batched to avoid long streaming result sets","Set sane server query timeouts above expected query duration","Use connection pooling with health checks"],"tags":["sql","rows-iteration","journal","connection"],"backgroundTag":"sql-rows-iteration-error","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}