gastownhall/beads · error
db: DeleteConfig %s: %w
Error message
db: DeleteConfig %s: %w
What it means
This error wraps failure of the DELETE FROM config statement in DeleteConfig. Deleting a nonexistent key is not an error (DELETE simply matches zero rows), so this wrapper fires only when the statement itself fails at the driver level. The key being deleted is named in the message.
Source
Thrown at internal/storage/domain/db/config.go:104
// DoltStore.SetConfig. Reads are TABLE-FIRST — GetCustomTypes above
// consults custom_types and falls back to the string only when the table is
// empty, and GetCustomStatuses reads custom_statuses outright — so a write
// that updated only the string left the table holding the previous set,
// forever: `bd config set types.custom` on a proxied deployment reported
// success and `bd create -t <the new type>` kept answering "invalid issue
// type", with doctor re-verifying against the string and reporting all-OK.
//
// The caller supplies a transactional runner, so the row and its projection
// commit together or neither does.
if _, err := issueops.SyncConfigTables(ctx, r.runner, key, value); err != nil {
return fmt.Errorf("db: SetConfig %s: %w", key, err)
}
return nil
}
func (r *configSQLRepositoryImpl) DeleteConfig(ctx context.Context, key string) error {
if _, err := r.runner.ExecContext(ctx, "DELETE FROM config WHERE `key` = ?", key); err != nil {
return fmt.Errorf("db: DeleteConfig %s: %w", key, err)
}
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
}View on GitHub (pinned to 71377f2769)
Solutions
- Check the wrapped cause; if 'no such table: config', run schema migration first
- Ensure no concurrent bd process holds the database lock, then retry
- Verify the database file and directory are writable (not read-only mount)
- Check disk space and database file integrity
- If the key does not exist and you expected success, verify key spelling — absence alone does not throw this error
Defensive patterns
Strategy: try-catch
Validate before calling
if err := ensureSchemaMigrated(ctx); err != nil {
return fmt.Errorf("config table unavailable: %w", err)
} Try / catch
if err := repo.DeleteConfig(ctx, key); err != nil {
if isLockErr(err) {
// wait and retry once
}
return fmt.Errorf("deleting config %q: %w", key, err)
} Prevention
- Deleting a missing key succeeds silently — verify key spelling if a delete 'did nothing'
- Migrate schema after upgrades so the config table exists
- Ensure the database directory is on a writable filesystem
- Avoid concurrent writers on the same repo database
When it happens
Trigger: Calling DeleteConfig(ctx, key) when the DELETE fails: config table missing, database locked by another process, connection lost mid-statement, or IO/constraint error from the driver.
Common situations: Removing a prefix or config override on a stale-schema database; concurrent bd processes contending for locks; read-only filesystem or insufficient permissions on the database file.
Related errors
- ErrExec
- database not available: %w
- search gates: %w
- database not available: %w
- failed to get template: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/29d494a6317aaeb7.
Report an issue: GitHub.