gastownhall/beads · error
db: GetCustomTypes: %w
Error message
db: GetCustomTypes: %w
What it means
This error wraps a failure from GetConfig(ctx, "types.custom") — a SELECT on the config table — inside readCustomTypesTable's fallback path in GetCustomTypes. It is only reached when the custom_types table returned no rows, meaning the store is falling back to the legacy types.custom config string. The underlying cause is a driver/connection-level failure, since a missing key returns empty string without error.
Source
Thrown at internal/storage/domain/db/config.go:175
for rows.Next() {
var name string
if err := rows.Scan(&name); err != nil {
return nil, fmt.Errorf("db: GetCustomTypes: scan custom_types: %w", err)
}
if name = strings.TrimSpace(name); name != "" {
out = append(out, name)
}
}
if err := rows.Err(); err != nil {
return nil, fmt.Errorf("db: GetCustomTypes: read custom_types: %w", err)
}
return out, nil
}
func (r *configSQLRepositoryImpl) readCustomTypesConfig(ctx context.Context) ([]string, error) {
value, err := r.GetConfig(ctx, "types.custom")
if err != nil {
return nil, fmt.Errorf("db: GetCustomTypes: %w", err)
}
return issueops.ParseTypesConfigValue(value), nil
}
func unionWithYAMLCustomTypes(dbTypes, yamlTypes []string) []string {
if len(dbTypes) == 0 && len(yamlTypes) == 0 {
return nil
}
seen := make(map[string]struct{}, len(dbTypes)+len(yamlTypes))
out := make([]string, 0, len(dbTypes)+len(yamlTypes))
for _, src := range [][]string{dbTypes, yamlTypes} {
for _, t := range src {
t = strings.TrimSpace(t)
if t == "" {
continue
}
if _, ok := seen[t]; ok {
continueView on GitHub (pinned to 71377f2769)
Solutions
- Unwrap the error to see the underlying GetConfig/driver failure.
- Reconnect or retry once the database connection is healthy.
- Populate the custom_types table via bd config set types.custom ... so the fallback path (and this failure point) is avoided.
- Check server health/logs if the config table itself is unreadable.
Example fix
// before
if err != nil {
return nil, err // opaque wrapped db: GetCustomTypes error
}
// after
if err != nil {
log.Printf("custom types fallback read failed: %v", err)
// inspect cause: errors.Is(err, context.Canceled), driver errors, etc.
return nil, err
} Defensive patterns
Strategy: try-catch
Try / catch
types, err := store.GetCustomTypes(ctx)
if err != nil {
var derr *driverError
if errors.As(err, &derr) {
log.Printf("custom-types fallback read failed: %v", derr)
return defaultTypes, nil // or retry
}
return nil, err
} Prevention
- Keep the custom_types table populated so the legacy fallback path is rarely used.
- Classify wrapped causes with errors.Is/errors.As before deciding to retry or fail.
- Monitor database connectivity health in deployment environments.
When it happens
Trigger: Calling GetCustomTypes on a store whose custom_types table is empty (or nonexistent), and the subsequent GetConfig("types.custom") SELECT on the config table fails with a driver error (connection drop, cancelled context, server error).
Common situations: Legacy deployments that still store custom types in the config string; remote Dolt servers with flaky connectivity; context cancellation during fallback reads.
Related errors
- failed to load config: %w
- no database configuration found
- failed to import config %q: %w
- failed to set issue_prefix from imported issues: %w
- failed to read issue_id_mode config: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/edb25a026a60eb7b.
Report an issue: GitHub.