{"record":{"id":"c7b8a08cc271e443","repo":"gastownhall/beads","slug":"set-dolt-allow-commit-conflicts-w","errorCode":null,"errorMessage":"set dolt_allow_commit_conflicts: %w","messagePattern":"set dolt_allow_commit_conflicts: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/versioncontrolops/conflicts.go","lineNumber":250,"sourceCode":"func ResolveConflictRows(ctx context.Context, db DBConn, table string, keys []string, strategy string) (int, error) {\n\tif err := ValidateConflictTable(table); err != nil {\n\t\treturn 0, err\n\t}\n\tif err := ValidateConflictStrategy(strategy); err != nil {\n\t\treturn 0, err\n\t}\n\tkeyCol, ok := conflictRowKeyColumn[table]\n\tif !ok {\n\t\treturn 0, fmt.Errorf(\"per-row conflict resolution is not supported for table %s; resolve the whole table instead\", table)\n\t}\n\tif len(keys) == 0 {\n\t\treturn 0, nil\n\t}\n\t// A conflicted table cannot be written — nor the session committed —\n\t// without dolt's conflict-tolerance flags (the same pair MergeAndSettle\n\t// sets). They are session state, which is why db must be one session.\n\tif _, err := db.ExecContext(ctx, \"SET @@dolt_allow_commit_conflicts = 1\"); err != nil {\n\t\treturn 0, fmt.Errorf(\"set dolt_allow_commit_conflicts: %w\", err)\n\t}\n\tif _, err := db.ExecContext(ctx, \"SET @@dolt_force_transaction_commit = 1\"); err != nil {\n\t\treturn 0, fmt.Errorf(\"set dolt_force_transaction_commit: %w\", err)\n\t}\n\n\tresolved := 0\n\tfor _, key := range keys {\n\t\trow, err := loadConflictRow(ctx, db, table, keyCol, key)\n\t\tif err != nil {\n\t\t\treturn resolved, err\n\t\t}\n\t\tif err := resolveOneConflictRow(ctx, db, table, keyCol, key, strategy, row); err != nil {\n\t\t\treturn resolved, err\n\t\t}\n\t\tresolved++\n\t}\n\treturn resolved, nil\n}","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/versioncontrolops/conflicts.go#L232-L268","documentation":"ResolveConflictRows must set the dolt session variable dolt_allow_commit_conflicts=1 so writes and commits can proceed while conflicts exist. This error wraps the failure of that SET statement. Because these are session variables, they require a live single session; failure usually means the connection is dead, the dolt version is too old, or the variable is restricted.","triggerScenarios":"Calling ResolveConflictRows when the dolt server rejects SET @@dolt_allow_commit_conflicts — old dolt version without the variable, read-only/restricted session, or broken connection between the client and sql-server.","commonSituations":"Upgrading beads/driver without matching dolt server version; connecting through a proxy or middleware that filters SET statements; session terminated between calls; connecting to a non-dolt MySQL-compatible endpoint that lacks dolt variables.","solutions":["Upgrade the dolt server to a version supporting dolt_allow_commit_conflicts","Verify the endpoint is a real dolt sql-server, not a generic MySQL proxy","Check the wrapped error for 'unknown system variable' vs connection errors","Confirm the connection is alive and retry"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"var v string\nif err := db.QueryRowContext(ctx, \"SELECT @@dolt_allow_commit_conflicts\").Scan(&v); err != nil {\n    return fmt.Errorf(\"dolt version lacks conflict-tolerance support: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"n, err := versioncontrolops.ResolveConflictRows(ctx, db, table, keys, strat)\nif err != nil {\n    if strings.Contains(err.Error(), \"dolt_allow_commit_conflicts\") {\n        return fmt.Errorf(\"upgrade dolt server to a version supporting conflict-tolerant commits: %w\", err)\n    }\n    return err\n}","preventionTips":["Check dolt server version at startup and fail fast if too old","Connect directly to dolt sql-server, not via filtering proxies","Test SET of both session variables in a readiness probe"],"tags":["dolt","session-variable","database","configuration"],"backgroundTag":"unknown-system-variable","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}