gastownhall/beads · error
creating wisp_dependencies for migration 0047: %w
Error message
creating wisp_dependencies for migration 0047: %w
What it means
When wisp_dependencies is missing, the repair creates it from wispDependenciesTableDDLForMigration0047 — the split-target shape with foreign keys to wisps and issues. This error wraps failure of that CREATE TABLE: most commonly a missing/mismatched FK target, a connection drop mid-DDL, or Dolt rejecting a DDL feature (CHECK constraint, UUID() expression default).
Source
Thrown at internal/storage/schema/migration_repairs.go:216
// (lease columns added then removed again) or 56 belongs here.
func ensureWispTablesForMixedBlockedRecompute(ctx context.Context, db DBConn) error {
hasWisps, err := schemaTableExists(ctx, db, "wisps")
if err != nil {
return fmt.Errorf("checking wisps table: %w", err)
}
if !hasWisps {
if _, err := db.ExecContext(ctx, wispsTableDDLForMigration0047); err != nil {
return fmt.Errorf("creating wisps for migration 0047: %w", err)
}
}
hasWispDeps, err := schemaTableExists(ctx, db, "wisp_dependencies")
if err != nil {
return fmt.Errorf("checking wisp_dependencies table: %w", err)
}
if !hasWispDeps {
if _, err := db.ExecContext(ctx, wispDependenciesTableDDLForMigration0047); err != nil {
return fmt.Errorf("creating wisp_dependencies for migration 0047: %w", err)
}
return nil
}
return ensureWispDependenciesSplitTargets(ctx, db)
}
// ensureWispIsBlockedForRecompute repairs a drift shape in ignored/0006's own
// guard: it no-ops (SELECT 1) when wisps does not exist yet at the moment it
// runs, and once the ignored cursor advances past 6 that migration is never
// pending again (pending = version > MAX(cursor); a missing low-numbered row
// does not lower the high-water mark). wisps can be materialized without
// is_blocked several ways -- ignored/0001's own CREATE-then-RENAME leaves an
// existing wisps table untouched, and the main-side 0047 repair above
// creates wisps at the wispsTableDDLForMigration0047 shape, which has no
// is_blocked column, whenever the main pass reaches version 47 with wisps
// entirely missing. Whichever path, a clone that ends up there permanently
// lacks the column, and BOTH ignored/0007 and ignored/0015's frozenView on GitHub (pinned to 71377f2769)
Solutions
- Retry bd init — the DDL is CREATE TABLE IF NOT EXISTS and idempotent
- Verify the FK target tables (wisps, issues) exist with an id column; the wisps branch runs first in the same repair
- Check the Dolt server version supports CHECK constraints and expression defaults; upgrade if not
- Inspect the wrapped SQL error for the failing clause (FK vs CHECK vs connection)
Defensive patterns
Strategy: validation
Validate before calling
// ensure FK targets exist before the DDL can succeed
for _, t := range []string{"wisps", "issues"} {
var n int
db.QueryRowContext(ctx, `SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = ?`, t).Scan(&n)
if n == 0 { return fmt.Errorf("FK target %s missing; cannot create wisp_dependencies", t) }
} Try / catch
if _, err := db.ExecContext(ctx, wispDependenciesTableDDLForMigration0047); err != nil {
if isUnsupportedDDL(err) { // CHECK constraint / expression default rejected
return fmt.Errorf("upgrade Dolt server: %w", err)
}
return err
} Prevention
- Verify Dolt server version supports CHECK constraints and expression defaults before upgrading
- Ensure the wisps branch of the repair ran first — it creates the FK target
- Retry after transient failures; DDL is CREATE TABLE IF NOT EXISTS
- Check for stale conflicting objects before re-running init
When it happens
Trigger: Clone reaching 0047 with wisp_dependencies absent; CREATE TABLE fails because wisps/issues are missing or drifted (FK targets), the connection dropped, or the Dolt server does not support a DDL feature used.
Common situations: Clone-skew after a schema bump; older Dolt server lacking feature support; interrupted prior init leaving wisps created but wisp_dependencies not; drifted issues table missing FK target columns.
Related errors
- creating wisps for migration 0047: %w
- dropping %s for the 0058 repair: %w
- clone from %s succeeded, but the database needs %d schema %s
- read labels for %s: %w
- copy label %q for %s: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/a30fc7528d1281ca.
Report an issue: GitHub.