{"record":{"id":"aae37d1b0a4abb8a","repo":"gastownhall/beads","slug":"checking-wisp-dependencies-depends-on-id-w","errorCode":null,"errorMessage":"checking wisp_dependencies.depends_on_id: %w","messagePattern":"checking wisp_dependencies\\.depends_on_id: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/schema/migration_repairs.go","lineNumber":639,"sourceCode":"\tif !table {\n\t\treturn nil\n\t}\n\n\tfor _, col := range wispDependenciesSplitTargetColumns() {\n\t\tpresent, err := schemaColumnExists(ctx, db, \"wisp_dependencies\", col.name)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"checking wisp_dependencies.%s: %w\", col.name, err)\n\t\t}\n\t\tif !present {\n\t\t\tif _, err := db.ExecContext(ctx, \"ALTER TABLE wisp_dependencies ADD COLUMN \"+col.name+\" \"+col.definition); err != nil {\n\t\t\t\treturn fmt.Errorf(\"adding wisp_dependencies.%s for migration 0053: %w\", col.name, err)\n\t\t\t}\n\t\t}\n\t}\n\n\tlegacyTarget, err := schemaColumnExists(ctx, db, \"wisp_dependencies\", \"depends_on_id\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"checking wisp_dependencies.depends_on_id: %w\", err)\n\t}\n\tif !legacyTarget {\n\t\t// Nothing left to backfill from: either a prior pass already\n\t\t// finished (depends_on_id has since been dropped) or this database\n\t\t// never had the legacy column to begin with.\n\t\treturn nil\n\t}\n\n\tfor _, repair := range wispDependenciesSplitTargetBackfillSQL() {\n\t\tif _, err := db.ExecContext(ctx, repair); err != nil {\n\t\t\treturn fmt.Errorf(\"backfilling wisp_dependencies split targets for migration 0053: %w\", err)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc wispDependenciesSplitTargetColumns() []struct{ name, definition string } {\n\treturn []struct{ name, definition string }{","sourceCodeStart":621,"sourceCodeEnd":657,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/schema/migration_repairs.go#L621-L657","documentation":"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.","triggerScenarios":"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.","commonSituations":"Server restart or connection drop partway through the multi-step repair; ctx deadline exceeded after several prior statements; permission issues on INFORMATION_SCHEMA.","solutions":["Inspect the wrapped cause and restore the DB connection/server.","Re-run the repair — it re-probes from the top and is idempotent.","Ensure the context used for migration has an adequate timeout.","Verify SELECT access to INFORMATION_SCHEMA for the configured user."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// verify server reachable and introspection readable before repair\nvar n int\nerr := db.QueryRowContext(ctx, `SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=DATABASE()`).Scan(&n)","typeGuard":"func isConnLoss(err error) bool {\n    return errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) || strings.Contains(err.Error(), \"driver: bad connection\")\n}","tryCatchPattern":"if err := ensureWispDependenciesSplitTargets(ctx, db); err != nil {\n    if isConnLoss(err) { /* reconnect and re-run */ }\n    return err\n}","preventionTips":["Use a context with adequate deadline for multi-step repairs","Keep the Dolt server alive for the whole migration window","Verify INFORMATION_SCHEMA access permissions","Re-run repairs — they are idempotent"],"tags":["database","migration","schema-introspection"],"backgroundTag":"schema-introspection-query-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}