gastownhall/beads · error
db: GetAllConfig: read: %w
Error message
db: GetAllConfig: read: %w
What it means
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.
Source
Thrown at internal/storage/domain/db/config.go:124
return nil
}
func (r *configSQLRepositoryImpl) GetAllConfig(ctx context.Context) (map[string]string, error) {
rows, err := r.runner.QueryContext(ctx, "SELECT `key`, value FROM config")
if err != nil {
return nil, fmt.Errorf("db: GetAllConfig: %w", err)
}
defer rows.Close()
out := make(map[string]string)
for rows.Next() {
var k, v string
if err := rows.Scan(&k, &v); err != nil {
return nil, fmt.Errorf("db: GetAllConfig: scan: %w", err)
}
out[k] = v
}
if err := rows.Err(); err != nil {
return nil, fmt.Errorf("db: GetAllConfig: read: %w", err)
}
return out, nil
}
func (r *configSQLRepositoryImpl) GetCustomTypes(ctx context.Context) ([]string, error) {
fromTable, err := r.readCustomTypesTable(ctx)
if err != nil {
return nil, err
}
fromDB := fromTable
if len(fromDB) == 0 {
fromConfig, err := r.readCustomTypesConfig(ctx)
if err != nil {
return nil, err
}
fromDB = fromConfig
}View on GitHub (pinned to 71377f2769)
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`
Defensive patterns
Strategy: retry
Validate before calling
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) defer cancel() // generous budget for full enumeration
Try / catch
var all map[string]string
err := retry.Do(3, retry.Backoff(time.Second), func() error {
var e error
all, e = repo.GetAllConfig(ctx)
return e
})
if err != nil {
return fmt.Errorf("config enumeration failed after retries: %w", err)
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/008a0b3e631767cf.
Report an issue: GitHub.