{"record":{"id":"e30e3eeb4b4bd5a6","repo":"gastownhall/beads","slug":"set-dolt-allow-commit-conflicts-w-e30e3e","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/mergesettle.go","lineNumber":66,"sourceCode":"func MergeAndSettle(ctx context.Context, db DBConn, ref string) error {\n\treturn MergeAndSettleWithStrategy(ctx, db, ref, \"\")\n}\n\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","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/versioncontrolops/mergesettle.go#L48-L84","documentation":"MergeAndSettleWithStrategy first sets the session variable @@dolt_allow_commit_conflicts=1 so a conflicted merge lands in the working set instead of rolling back. \"set dolt_allow_commit_conflicts: %w\" wraps the failure of that SET statement. It means the session could not enable conflict tolerance — typically the server is not Dolt, the variable name is unsupported, or the connection is broken.","triggerScenarios":"Calling MergeAndSettle/MergeAndSettleWithStrategy against a non-Dolt MySQL server or a Dolt version lacking dolt_allow_commit_conflicts; a closed or broken connection; context cancellation before the SET executes.","commonSituations":"Running embedded-mode pull against a downgraded/older Dolt engine; pointing the pull path at a plain MySQL replica; connection dropped by a proxy between commands.","solutions":["Verify the backend is Dolt and recent enough to support @@dolt_allow_commit_conflicts (try `SET @@dolt_allow_commit_conflicts = 1` manually)","Check the connection/session is alive and pinned (single session, not rotating pool connections)","Inspect the wrapped driver error to distinguish unknown-variable from connection errors","Upgrade the Dolt engine/server if the variable is unrecognized"],"exampleFix":"// before: opaque SET failure on unknown backend\nerr := versioncontrolops.MergeAndSettle(ctx, db, ref)\n// after: pre-flight capability check\nif _, err := db.ExecContext(ctx, \"SET @@dolt_allow_commit_conflicts = 1\"); err != nil {\n\treturn fmt.Errorf(\"backend does not support dolt_allow_commit_conflicts (is this Dolt?): %w\", err)\n}\nerr = versioncontrolops.MergeAndSettle(ctx, db, ref)","handlingStrategy":"try-catch","validationCode":"// capability pre-flight on the same session used for the merge\nif _, err := db.ExecContext(ctx, \"SET @@dolt_allow_commit_conflicts = 1\"); err != nil {\n\treturn fmt.Errorf(\"backend lacks conflict-tolerant merge (Dolt 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(\"Dolt version too old for auto-settle merge: %w\", err)\n\t}\n\treturn fmt.Errorf(\"merge settle failed: %w\", err)\n}","preventionTips":["Pin the minimum Dolt engine version required by bd","Use one pinned session for the whole merge-settle sequence","Health-check session variables at startup","Reconnect and retry once on transient connection errors"],"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"}