{"record":{"id":"29d494a6317aaeb7","repo":"gastownhall/beads","slug":"db-deleteconfig-s-w","errorCode":null,"errorMessage":"db: DeleteConfig %s: %w","messagePattern":"db: DeleteConfig (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/domain/db/config.go","lineNumber":104,"sourceCode":"\t// DoltStore.SetConfig. Reads are TABLE-FIRST — GetCustomTypes above\n\t// consults custom_types and falls back to the string only when the table is\n\t// empty, and GetCustomStatuses reads custom_statuses outright — so a write\n\t// that updated only the string left the table holding the previous set,\n\t// forever: `bd config set types.custom` on a proxied deployment reported\n\t// success and `bd create -t <the new type>` kept answering \"invalid issue\n\t// type\", with doctor re-verifying against the string and reporting all-OK.\n\t//\n\t// The caller supplies a transactional runner, so the row and its projection\n\t// commit together or neither does.\n\tif _, err := issueops.SyncConfigTables(ctx, r.runner, key, value); err != nil {\n\t\treturn fmt.Errorf(\"db: SetConfig %s: %w\", key, err)\n\t}\n\treturn nil\n}\n\nfunc (r *configSQLRepositoryImpl) DeleteConfig(ctx context.Context, key string) error {\n\tif _, err := r.runner.ExecContext(ctx, \"DELETE FROM config WHERE `key` = ?\", key); err != nil {\n\t\treturn fmt.Errorf(\"db: DeleteConfig %s: %w\", key, err)\n\t}\n\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}","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/domain/db/config.go#L86-L122","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if err := ensureSchemaMigrated(ctx); err != nil {\n\treturn fmt.Errorf(\"config table unavailable: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := repo.DeleteConfig(ctx, key); err != nil {\n\tif isLockErr(err) {\n\t\t// wait and retry once\n\t}\n\treturn fmt.Errorf(\"deleting config %q: %w\", key, err)\n}","preventionTips":["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"],"tags":["database","storage","dolt","delete-failed"],"backgroundTag":"sql-write-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}