gastownhall/beads · error

checking issues.%s: %w

Error message

checking issues.%s: %w

What it means

Wraps failure of the `schemaColumnExists(ctx, db, "issues", col.name)` probe used by ensureIssuesRigColumns while checking whether each 0053 rig column (role_type, rig) already exists on `issues`. An introspection failure here aborts the column-ensure step.

Source

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

// added to the squashed bootstrap 0001_create_issues, so a database
// bootstrapped before they existed reaches schema v52 without them, and
// migration 0053 — which copies exactly these columns from wisps into
// issues — fails with "Unknown column" even with zero rig wisps to repair.
// Databases in the wild may have some but not all six, so each is checked
// individually. Definitions mirror the current bootstrap schema.
func ensureIssuesRigColumns(ctx context.Context, db DBConn) error {
	columns := []struct{ name, definition string }{
		{"hook_bead", "VARCHAR(255) DEFAULT ''"},
		{"role_bead", "VARCHAR(255) DEFAULT ''"},
		{"agent_state", "VARCHAR(32) DEFAULT ''"},
		{"last_activity", "DATETIME"},
		{"role_type", "VARCHAR(32) DEFAULT ''"},
		{"rig", "VARCHAR(255) DEFAULT ''"},
	}
	for _, col := range columns {
		present, err := schemaColumnExists(ctx, db, "issues", col.name)
		if err != nil {
			return fmt.Errorf("checking issues.%s: %w", col.name, err)
		}
		if present {
			continue
		}
		if _, err := db.ExecContext(ctx, "ALTER TABLE issues ADD COLUMN "+col.name+" "+col.definition); err != nil {
			return fmt.Errorf("adding issues.%s for migration 0053: %w", col.name, err)
		}
	}
	return nil
}

// ensureWispDependenciesSplitTargets repairs #4555: a mixed-vintage local
// wisp_dependencies table can have the post-0005 id column while still lacking
// one or more split target columns. Migration 0053 reads those columns when it
// repairs rig wisps, so add the missing columns and backfill them from the
// legacy depends_on_id column when that source column is still available.
//
// Column presence is not, by itself, proof the backfill below ever ran: a

View on GitHub (pinned to 71377f2769)

Solutions

  1. Rerun `bd`; the check is read-only and idempotent
  2. Fix the wrapped %w cause (start server, repair credentials/network)
  3. Confirm the user can read information_schema.COLUMNS for the `issues` table
  4. If a previous run crashed, restart the Dolt server cleanly before retrying

Example fix

// before: stale Dolt daemon after crash
bd dolt server restart
// after
bd ready
Defensive patterns

Strategy: retry

Validate before calling

bd dolt sql -q "SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_NAME='issues' AND COLUMN_NAME IN ('role_type','rig')" || echo 'introspection unavailable'

Try / catch

if err := ensureSchema(ctx, db); err != nil {
    if strings.Contains(err.Error(), "checking issues.") && transient(err) {
        return retryWithBackoff(ensureSchema)
    }
    return err
}

Prevention

When it happens

Trigger: repairV53RigAndSplitTargets (and its test) runs during startup; the information_schema existence check for `issues.role_type` or `issues.rig` errors — server unreachable, permission denied on metadata, transient connection failure.

Common situations: Dolt server down during upgrade; restricted DB user; interrupted/duplicated schema repair where a previous run left the connection pool stale.

Related errors


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