{"record":{"id":"ef8acdde8963c0fc","repo":"gastownhall/beads","slug":"set-dolt-force-transaction-commit-w-ef8acd","errorCode":null,"errorMessage":"set dolt_force_transaction_commit: %w","messagePattern":"set dolt_force_transaction_commit: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/versioncontrolops/mergesettle.go","lineNumber":69,"sourceCode":"\n// MergeAndSettleWithStrategy is MergeAndSettle with an operator escape hatch\n// (#4992 part 2): a conflict TryAutoResolveMergeConflicts declines is, when\n// strategy is non-empty, resolved with strategy (\"ours\" or \"theirs\") instead\n// of aborting the merge for the operator. strategy == \"\" is exactly\n// MergeAndSettle's behavior (a declined conflict aborts with\n// MergeConflictsError). Used by the embedded pull path's `--strategy` flag;\n// see SettleMerge for the resolution logic.\nfunc MergeAndSettleWithStrategy(ctx context.Context, db DBConn, ref, strategy string) error {\n\t// Capture pre-merge cleanliness before anything runs: abortMerge's\n\t// hard-reset fallback is only safe when nothing uncommitted predates\n\t// the merge (bd-578h9.2).\n\tpreMergeClean := workingSetClean(ctx, db)\n\n\tif _, err := db.ExecContext(ctx, \"SET @@dolt_allow_commit_conflicts = 1\"); err != nil {\n\t\treturn 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 fmt.Errorf(\"set dolt_force_transaction_commit: %w\", err)\n\t}\n\n\t_, mergeErr := db.ExecContext(ctx, \"CALL DOLT_MERGE(?)\", ref)\n\tif mergeErr != nil && strings.Contains(mergeErr.Error(), \"up to date\") {\n\t\t// DOLT_PULL swallows \"Already up to date.\" internally; we do the same.\n\t\tmergeErr = nil\n\t}\n\treturn SettleMerge(ctx, db, mergeErr, preMergeClean, strategy)\n}\n\n// MergeConflictsError reports the conflicts a settle pass refused to\n// auto-resolve. By the time the caller sees it the merge has been aborted (or\n// the transaction rolled back) and the working set restored, so the conflicts\n// are no longer queryable from dolt_conflicts — they were captured before the\n// abort precisely so callers with a conflict-reporting contract (PullFrom) can\n// still surface them (bd-578h9.15). Unwrap returns the merge statement's own\n// error, when there was one.\ntype MergeConflictsError struct {","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/versioncontrolops/mergesettle.go#L51-L87","documentation":"Immediately after enabling conflict tolerance, MergeAndSettleWithStrategy sets @@dolt_force_transaction_commit=1 so the merge can land despite FK violations for later repair. \"set dolt_force_transaction_commit: %w\" wraps that SET's failure. Same causes as the allow_commit_conflicts failure: non-Dolt backend, old Dolt version, or dead connection.","triggerScenarios":"Calling MergeAndSettle/MergeAndSettleWithStrategy on a Dolt version without dolt_force_transaction_commit; broken/closed connection; context deadline hit between the two SETs.","commonSituations":"Mixed-version Dolt deployments where one clone's engine predates the force-commit flag; connections killed by an idle proxy mid-pull.","solutions":["Verify the Dolt engine supports @@dolt_force_transaction_commit; upgrade if not","Check the session is a single pinned connection whose state persists to the merge call","Inspect the wrapped error: 'Unknown system variable' means version mismatch; connection errors mean retry/reconnect","Ensure no earlier statement in the session poisoned the connection"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if _, err := db.ExecContext(ctx, \"SET @@dolt_force_transaction_commit = 1\"); err != nil {\n\treturn fmt.Errorf(\"Dolt engine lacks force_transaction_commit (upgrade required): %w\", err)\n}","typeGuard":"func isUnknownVariable(err error) bool { return strings.Contains(err.Error(), \"Unknown system variable\") || strings.Contains(err.Error(), \"1193\") }","tryCatchPattern":"err := versioncontrolops.MergeAndSettle(ctx, db, ref)\nif err != nil {\n\tif isUnknownVariable(err) {\n\t\treturn fmt.Errorf(\"upgrade Dolt to a version supporting dolt_force_transaction_commit: %w\", err)\n\t}\n\treturn fmt.Errorf(\"merge settle failed: %w\", err)\n}","preventionTips":["Keep all clones on a bd/Dolt version that supports the force-commit flag","Test session-variable support as part of the pull pre-flight","Hold the merge on a single pinned connection","Treat 'Unknown system variable' errors as version-skew signals, not bugs"],"tags":["dolt","merge","session-variable"],"backgroundTag":"unsupported-dolt-session-variable","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}