{"record":{"id":"42c1c07548a1d21f","repo":"gastownhall/beads","slug":"failed-to-scan-conflict-w","errorCode":null,"errorMessage":"failed to scan conflict: %w","messagePattern":"failed to scan conflict: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/dolt/history.go","lineNumber":177,"sourceCode":"\t})\n\treturn result, err\n}\n\n// getInternalConflicts returns any merge conflicts in the current state (internal format).\n// For the public interface, use GetConflicts which returns storage.Conflict.\nfunc (s *DoltStore) getInternalConflicts(ctx context.Context) ([]*tableConflict, error) {\n\trows, err := s.queryContext(ctx,\n\t\t\"SELECT `table`, num_conflicts FROM dolt_conflicts\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get conflicts: %w\", err)\n\t}\n\tdefer rows.Close()\n\n\tvar conflicts []*tableConflict\n\tfor rows.Next() {\n\t\tvar c tableConflict\n\t\tif err := rows.Scan(&c.TableName, &c.NumConflicts); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to scan conflict: %w\", err)\n\t\t}\n\t\tconflicts = append(conflicts, &c)\n\t}\n\n\treturn conflicts, rows.Err()\n}\n\n// tableConflict represents a Dolt table-level merge conflict (internal representation).\ntype tableConflict struct {\n\tTableName    string\n\tNumConflicts int\n}\n\n// ResolveConflicts resolves conflicts using the specified strategy\nfunc (s *DoltStore) ResolveConflicts(ctx context.Context, table string, strategy string) error {\n\treturn versioncontrolops.ResolveConflicts(ctx, s.db, table, strategy)\n}\n","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/dolt/history.go#L159-L195","documentation":"Each row from dolt_conflicts is scanned into a tableConflict struct with two targets (`table`, num_conflicts). This error indicates rows.Scan failed — a column-count/type mismatch between what the engine returned and the two scan targets, or a value that cannot be decoded into the target Go types. rows.Err() afterwards would report iteration-level errors separately.","triggerScenarios":"The dolt_conflicts system table returns a different column set than expected (engine version changed the schema, e.g. extra conflict-detail columns), or a non-integer value lands in num_conflicts; also occurs if the driver returns NULL for a non-pointer scan target.","commonSituations":"Mixed Dolt server/client versions where the system table schema differs from what this beads build expects; connecting to a backend that emulates but does not exactly match Dolt's conflict table shape.","solutions":["Check the wrapped scan error for the offending column index and compare the engine's dolt_conflicts schema (SHOW CREATE TABLE) against the two expected columns.","Match Dolt server and beads versions — upgrade beads or pin the Dolt engine version the release was tested against.","Replace SELECT `table`, num_conflicts with an explicit column list matching the engine's actual schema if it has changed."],"exampleFix":"// before\nrows := s.queryContext(ctx, \"SELECT `table`, num_conflicts FROM dolt_conflicts\")\nrows.Scan(&c.TableName, &c.NumConflicts) // fails if engine adds columns\n// after\nrows := s.queryContext(ctx, \"SELECT `table`, num_conflicts FROM dolt_conflicts\") // verify against SHOW CREATE TABLE dolt_conflicts\nif err := rows.Scan(&c.TableName, &c.NumConflicts); err != nil {\n    return nil, fmt.Errorf(\"failed to scan conflict (check dolt engine version): %w\", err)\n}","handlingStrategy":"try-catch","validationCode":"cols, err := db.Query(\"SHOW COLUMNS FROM dolt_conflicts\")\n// confirm the first columns are `table` and num_conflicts before scanning","typeGuard":null,"tryCatchPattern":"conflicts, err := store.GetConflicts(ctx)\nif err != nil && strings.Contains(err.Error(), \"failed to scan conflict\") {\n    return fmt.Errorf(\"dolt_conflicts schema mismatch — check dolt engine version: %w\", err)\n}","preventionTips":["Pin Dolt engine versions in CI and deployments to avoid system-table schema drift.","Check the engine's dolt_conflicts schema after any Dolt upgrade.","Upgrade beads together with the storage engine, never independently."],"tags":["dolt","merge-conflicts","scan-error","schema-drift"],"backgroundTag":"row-scan-type-mismatch","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}