gastownhall/beads · error
custom_types: %w
Error message
custom_types: %w
What it means
Wrapper from needsBackfilledCustomStatusesCustomTypes when the probe needsCustomTypesBackfill fails. This probe runs as part of migrationWorkNeeded (MigrateUp's work-detection gate) and simply runs SELECT COUNT(*) FROM custom_types plus a config lookup; any SQL error here is wrapped so the caller knows migration gating itself couldn't be evaluated.
Source
Thrown at internal/storage/schema/backfill.go:29
"github.com/steveyegge/beads/internal/types"
)
func ensureBackfilledCustomStatusesCustomTypes(ctx context.Context, db DBConn) (bool, error) {
typesWrote, err := backfillCustomTypes(ctx, db)
if err != nil {
return typesWrote, fmt.Errorf("backfill custom_types: %w", err)
}
statusesWrote, err := backfillCustomStatuses(ctx, db)
if err != nil {
return typesWrote || statusesWrote, fmt.Errorf("backfill custom_statuses: %w", err)
}
return typesWrote || statusesWrote, nil
}
func needsBackfilledCustomStatusesCustomTypes(ctx context.Context, db DBConn) (bool, error) {
typesNeed, err := needsCustomTypesBackfill(ctx, db)
if err != nil {
return false, fmt.Errorf("custom_types: %w", err)
}
statusesNeed, err := needsCustomStatusesBackfill(ctx, db)
if err != nil {
return false, fmt.Errorf("custom_statuses: %w", err)
}
return typesNeed || statusesNeed, nil
}
func needsCustomTypesBackfill(ctx context.Context, db DBConn) (bool, error) {
var count int
if err := db.QueryRowContext(ctx, "SELECT COUNT(*) FROM custom_types").Scan(&count); err != nil {
return false, err
}
if count > 0 {
return false, nil
}
var value stringView on GitHub (pinned to 71377f2769)
Solutions
- Let MigrateUp proceed and create the schema — on a fresh DB the missing table is expected; complete the migration flow.
- Check Dolt server connectivity and retry opening the database.
- Verify SELECT privileges on custom_types and config.
- If the table should exist, run `bd doctor` schema checks or restore from backup.
Defensive patterns
Strategy: retry
Validate before calling
// Check base tables exist before probing migration state
var n int
err := db.QueryRowContext(ctx, `SELECT COUNT(*) FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME IN ('custom_types','config')`).Scan(&n)
if err == nil && n < 2 {
// fresh database: skip probes, go straight to MigrateUp
} Try / catch
err := openAndMigrate(ctx)
if err != nil && strings.Contains(err.Error(), "custom_types:") {
if isMissingTableErr(err) || isTransient(err) {
err = openAndMigrate(ctx) // full migration creates the missing table
}
} Prevention
- On a fresh database, always invoke the full MigrateUp rather than only read/probe paths
- Verify DB connectivity before running schema-dependent commands
- Grant the user SELECT on information_schema and config
- Retry opens after transient Dolt server unavailability
When it happens
Trigger: needsCustomTypesBackfill's SELECT COUNT(*) FROM custom_types or SELECT value FROM config WHERE key='types.custom' errors — usually because custom_types (or config) doesn't exist yet on a fresh or mid-upgrade database, or the connection/context failed.
Common situations: Fresh database probed before migrations created the tables; connection dropped during startup; restricted user lacking SELECT; Dolt server unavailable when `bd` opens the database.
Related errors
- custom_statuses: %w
- failed to migrate credential keys: %w
- failed to scan peer for migration: %w
- failed to iterate peers for migration: %w
- failed to update encrypted password for peer %s: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/cd3c786fdfd9c8a8.
Report an issue: GitHub.