{"record":{"id":"008a0b3e631767cf","repo":"gastownhall/beads","slug":"db-getallconfig-read-w","errorCode":null,"errorMessage":"db: GetAllConfig: read: %w","messagePattern":"db: GetAllConfig: read: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/domain/db/config.go","lineNumber":124,"sourceCode":"\treturn nil\n}\n\nfunc (r *configSQLRepositoryImpl) GetAllConfig(ctx context.Context) (map[string]string, error) {\n\trows, err := r.runner.QueryContext(ctx, \"SELECT `key`, value FROM config\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"db: GetAllConfig: %w\", err)\n\t}\n\tdefer rows.Close()\n\tout := make(map[string]string)\n\tfor rows.Next() {\n\t\tvar k, v string\n\t\tif err := rows.Scan(&k, &v); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"db: GetAllConfig: scan: %w\", err)\n\t\t}\n\t\tout[k] = v\n\t}\n\tif err := rows.Err(); err != nil {\n\t\treturn nil, fmt.Errorf(\"db: GetAllConfig: read: %w\", err)\n\t}\n\treturn out, nil\n}\n\nfunc (r *configSQLRepositoryImpl) GetCustomTypes(ctx context.Context) ([]string, error) {\n\tfromTable, err := r.readCustomTypesTable(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfromDB := fromTable\n\tif len(fromDB) == 0 {\n\t\tfromConfig, err := r.readCustomTypesConfig(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfromDB = fromConfig\n\t}","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/domain/db/config.go#L106-L142","documentation":"This error wraps the rows.Err() check at the end of GetAllConfig's iteration loop. It indicates the result-set iteration itself failed — typically a connection drop or context cancellation while streaming rows, after some rows may already have been consumed. It is distinct from the per-row scan error.","triggerScenarios":"Calling GetAllConfig and having the connection to the Dolt database drop or the context be canceled while rows.Next() is streaming results; driver-level IO errors mid-result-set.","commonSituations":"Long-running `bd config list` over a large config table with an aggressive context deadline; network/Unix-socket disruption to a remote Dolt server; database closed by another part of the process during iteration.","solutions":["Retry GetAllConfig with a longer or undisturbed context","Check the wrapped cause for context.DeadlineExceeded or Canceled and adjust the timeout/cancellation","Verify the Dolt connection (local file vs server) is stable; reconnect if remote","Ensure nothing in the process closes the database handle mid-iteration","If persistent, check server logs / database health via `bd doctor`"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)\ndefer cancel() // generous budget for full enumeration","typeGuard":null,"tryCatchPattern":"var all map[string]string\nerr := retry.Do(3, retry.Backoff(time.Second), func() error {\n\tvar e error\n\tall, e = repo.GetAllConfig(ctx)\n\treturn e\n})\nif err != nil {\n\treturn fmt.Errorf(\"config enumeration failed after retries: %w\", err)\n}","preventionTips":["Use a context that outlives the full result-set iteration","Retry enumeration on transient connection drops — it is a read and safe to repeat","Keep remote Dolt connections stable; avoid mid-iteration cancellation","Do not close the database handle while readers are active"],"tags":["database","dolt","iteration","context-canceled"],"backgroundTag":"sql-iteration-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}