gastownhall/beads · error

checking wisp_dependencies.depends_on_id: %w

Error message

checking wisp_dependencies.depends_on_id: %w

What it means

Wraps a failure from schemaColumnExists when checking whether the legacy depends_on_id column still exists on wisp_dependencies. This check gates the backfill: if depends_on_id is gone, the backfill is skipped because migration 0005 already dropped it (or it never existed). Thrown only when the introspection query itself fails, not when the column is absent.

Source

Thrown at internal/storage/schema/migration_repairs.go:639

	if !table {
		return nil
	}

	for _, col := range wispDependenciesSplitTargetColumns() {
		present, err := schemaColumnExists(ctx, db, "wisp_dependencies", col.name)
		if err != nil {
			return fmt.Errorf("checking wisp_dependencies.%s: %w", col.name, err)
		}
		if !present {
			if _, err := db.ExecContext(ctx, "ALTER TABLE wisp_dependencies ADD COLUMN "+col.name+" "+col.definition); err != nil {
				return fmt.Errorf("adding wisp_dependencies.%s for migration 0053: %w", col.name, err)
			}
		}
	}

	legacyTarget, err := schemaColumnExists(ctx, db, "wisp_dependencies", "depends_on_id")
	if err != nil {
		return fmt.Errorf("checking wisp_dependencies.depends_on_id: %w", err)
	}
	if !legacyTarget {
		// Nothing left to backfill from: either a prior pass already
		// finished (depends_on_id has since been dropped) or this database
		// never had the legacy column to begin with.
		return nil
	}

	for _, repair := range wispDependenciesSplitTargetBackfillSQL() {
		if _, err := db.ExecContext(ctx, repair); err != nil {
			return fmt.Errorf("backfilling wisp_dependencies split targets for migration 0053: %w", err)
		}
	}
	return nil
}

func wispDependenciesSplitTargetColumns() []struct{ name, definition string } {
	return []struct{ name, definition string }{

View on GitHub (pinned to 71377f2769)

Solutions

  1. Inspect the wrapped cause and restore the DB connection/server.
  2. Re-run the repair — it re-probes from the top and is idempotent.
  3. Ensure the context used for migration has an adequate timeout.
  4. Verify SELECT access to INFORMATION_SCHEMA for the configured user.
Defensive patterns

Strategy: retry

Validate before calling

// verify server reachable and introspection readable before repair
var n int
err := db.QueryRowContext(ctx, `SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=DATABASE()`).Scan(&n)

Type guard

func isConnLoss(err error) bool {
    return errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) || strings.Contains(err.Error(), "driver: bad connection")
}

Try / catch

if err := ensureWispDependenciesSplitTargets(ctx, db); err != nil {
    if isConnLoss(err) { /* reconnect and re-run */ }
    return err
}

Prevention

When it happens

Trigger: SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS for depends_on_id errors — Dolt server unreachable, context cancelled, or driver-level failure between the earlier column checks and this one.

Common situations: Server restart or connection drop partway through the multi-step repair; ctx deadline exceeded after several prior statements; permission issues on INFORMATION_SCHEMA.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/aae37d1b0a4abb8a. Report an issue: GitHub.