{"record":{"id":"debcbb86ffc4f440","repo":"gastownhall/beads","slug":"iter-dependents-scan-w","errorCode":null,"errorMessage":"iter dependents: scan: %w","messagePattern":"iter dependents: scan: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/dolt/iter_dependents.go","lineNumber":118,"sourceCode":"\t}\n\treturn &doltDependentsIter{s: s, conn: conn, rows: rows}, nil\n}\n\nfunc (it *doltDependentsIter) Next(ctx context.Context) bool {\n\tif it.err != nil || it.closed {\n\t\treturn false\n\t}\n\tif err := ctx.Err(); err != nil {\n\t\tit.err = err\n\t\treturn false\n\t}\n\tif !it.rows.Next() {\n\t\tit.err = it.rows.Err()\n\t\treturn false\n\t}\n\tiss, depType, err := scanIssueWithDepTypeFrom(it.rows)\n\tif err != nil {\n\t\tit.err = fmt.Errorf(\"iter dependents: scan: %w\", err)\n\t\treturn false\n\t}\n\t// NOTE: labels are NOT hydrated here. The corresponding slice path\n\t// (GetDependentsWithMetadata in dolt/dependencies.go) does not hydrate\n\t// either, so this matches for parity. Callers that need labels on\n\t// dependents must call GetLabels(id) explicitly.\n\tit.cur = &types.IssueWithDependencyMetadata{\n\t\tIssue:          *iss,\n\t\tDependencyType: types.DependencyType(depType),\n\t}\n\treturn true\n}\n\nfunc (it *doltDependentsIter) Value() *types.IssueWithDependencyMetadata { return it.cur }\nfunc (it *doltDependentsIter) Err() error                                { return it.err }\n\nfunc (it *doltDependentsIter) Close() error {\n\tif it.closed {","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/dolt/iter_dependents.go#L100-L136","documentation":"The dependents iterator failed while scanning a row from the underlying SQL result set into (issue, dependencyType) via scanIssueWithDepTypeFrom. This wraps the driver/scan error so callers of Next() see it with context when they later read it.Err(). It indicates row shape mismatch or a database-level failure mid-iteration.","triggerScenarios":"Calling DoltStore.Next() on the iterator returned by iteration over dependents when a result row cannot be scanned: NULL in a NOT-NULL-mapped column, unexpected column count/type after a schema change, or driver read error.","commonSituations":"Schema drift between the beads binary and an older/newer .beads Dolt database; manual schema edits; corrupted database rows; connection dropped mid-scan.","solutions":["Check it.Err() after iteration ends to see the wrapped underlying scan error","Verify the database schema matches the version of beads you are running (bd doctor / migration steps)","Re-open the store / retry the query to rule out a transient connection failure","If corruption is suspected, restore from git-backed export (.beads/issues.jsonl) or a Dolt backup"],"exampleFix":"// before: ignoring iterator error\nfor it.Next() { ... }\n\n// after: check iterator error\nfor it.Next() { ... }\nif err := it.Err(); err != nil {\n    return fmt.Errorf(\"iterating dependents: %w\", err)\n}","handlingStrategy":"try-catch","validationCode":"// No pre-call validation possible; ensure store is open and schema current.\nif store == nil { return errors.New(\"store not initialized\") }","typeGuard":null,"tryCatchPattern":"for it.Next() {\n    // process\n}\nif err := it.Err(); err != nil {\n    if strings.Contains(err.Error(), \"iter dependents: scan\") {\n        // handle scan/schema failure: log, run migrations, or abort\n    }\n}","preventionTips":["Always check it.Err() after iteration, not just the Next() loop","Keep beads binary and database schema versions in sync","Avoid manual edits to database tables"],"tags":["storage","dolt","iteration","sql-scan"],"backgroundTag":"sql-row-scan-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}