{"record":{"id":"5cef33b3135de62f","repo":"gastownhall/beads","slug":"scan-dolt-status-w","errorCode":null,"errorMessage":"scan dolt_status: %w","messagePattern":"scan dolt_status: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/versioncontrolops/fastforward.go","lineNumber":71,"sourceCode":"// changes, EXCLUDING dolt-ignored wisp tables (\"wisps\" and \"wisp_*\"), which\n// cannot be staged/committed and so should never block a clean-working-set\n// gate. This mirrors the exclusion in DirtyTableTracker.MarkDirty\n// (commit.go), but — unlike the unexported workingSetClean in\n// mergesettle.go, which does not exclude wisps and swallows its query\n// error — this reports the error to the caller instead of treating it as\n// dirty.\nfunc WorkingSetClean(ctx context.Context, db DBConn) (bool, error) {\n\trows, err := db.QueryContext(ctx, \"SELECT table_name FROM dolt_status\")\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"query dolt_status: %w\", err)\n\t}\n\tdefer rows.Close()\n\n\tclean := true\n\tfor rows.Next() {\n\t\tvar table string\n\t\tif err := rows.Scan(&table); err != nil {\n\t\t\treturn false, fmt.Errorf(\"scan dolt_status: %w\", err)\n\t\t}\n\t\tif table == \"wisps\" || strings.HasPrefix(table, \"wisp_\") {\n\t\t\tcontinue\n\t\t}\n\t\tclean = false\n\t}\n\tif err := rows.Err(); err != nil {\n\t\treturn false, fmt.Errorf(\"iterate dolt_status: %w\", err)\n\t}\n\n\treturn clean, nil\n}\n\n// FastForwardAdopt fast-forwards the current branch to ref via\n// CALL DOLT_MERGE('--ff-only', ref). ref must already be cached locally\n// (e.g. a remote-tracking ref updated by a prior fetch); this performs no\n// fetch of its own and fails if the merge would not be a pure fast-forward.\nfunc FastForwardAdopt(ctx context.Context, db DBConn, ref string) error {","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/versioncontrolops/fastforward.go#L53-L89","documentation":"While iterating dolt_status rows in WorkingSetClean, each row is scanned into a single string (table_name). If rows.Scan fails — e.g. unexpected column count or type returned by the Dolt engine — the error is wrapped as \"scan dolt_status: %w\" and the function reports dirty-unknown by returning false plus the error.","triggerScenarios":"Calling WorkingSetClean against a Dolt version whose dolt_status schema differs (extra columns, different column types), so a single-destination Scan fails; driver/driver-version mismatch.","commonSituations":"Upgrading or downgrading Dolt so the system table shape changed; using a generic SQL driver that returns extra columns for system tables; custom database/sql driver returning non-string types.","solutions":["Check the wrapped scan error and your Dolt/driver versions; align the client with the server's expected schema.","Upgrade beads / versioncontrolops to a version matching your Dolt engine version.","Test the query manually (SELECT table_name FROM dolt_status) to see the actual column shape.","Retry after restoring a compatible Dolt version."],"exampleFix":"// before\nrows, _ := db.QueryContext(ctx, \"SELECT * FROM dolt_status\") // schema drift\n// after\nrows, err := db.QueryContext(ctx, \"SELECT table_name FROM dolt_status\") // exact columns expected by Scan","handlingStrategy":"fallback","validationCode":"rows, err := db.QueryContext(ctx, \"SELECT table_name FROM dolt_status\")\nif err != nil { return err }\n// probe schema compatibility before relying on WorkingSetClean\nif _, err := db.QueryContext(ctx, \"SELECT table_name FROM dolt_status LIMIT 1\"); err != nil {\n    return fmt.Errorf(\"dolt_status schema incompatible: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"clean, err := versioncontrolops.WorkingSetClean(ctx, db)\nif err != nil && strings.Contains(err.Error(), \"scan dolt_status\") {\n    log.Warn(\"dolt_status schema mismatch; check Dolt version compatibility\")\n    return err\n}","preventionTips":["Pin your Dolt engine version to one tested with your beads/versioncontrolops release.","Test SELECT table_name FROM dolt_status manually after any Dolt upgrade.","Keep the query column list exact (table_name only) in any custom code — never SELECT *."],"tags":["dolt","sql","schema-mismatch","scan-error"],"backgroundTag":"sql-scan-mismatch","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}