{"record":{"id":"4f39b53e262a25e4","repo":"gastownhall/beads","slug":"conflicts-resolved-but-commit-failed-w","errorCode":null,"errorMessage":"conflicts resolved but commit failed: %w","messagePattern":"conflicts resolved but commit failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/versioncontrolops/mergesettle.go","lineNumber":225,"sourceCode":"\t// DOLT_COMMIT refuses a violated working set, so a merge carrying both\n\t// classes could never settle when the resolver committed first (bd-578h9.14).\n\tswitch {\n\tcase resolved:\n\t\tif err := CommitResolvedConflicts(ctx, db); err != nil {\n\t\t\tabortMerge(ctx, db, preMergeClean)\n\t\t\tif mergeErr != nil {\n\t\t\t\treturn mergeErr\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\tcase strategyResolved:\n\t\tmsg := fmt.Sprintf(\"Resolve merge conflicts using '%s' strategy\", strategy)\n\t\tif _, err := db.ExecContext(ctx, \"CALL DOLT_COMMIT('-m', ?)\", msg); err != nil {\n\t\t\tabortMerge(ctx, db, preMergeClean)\n\t\t\tif mergeErr != nil {\n\t\t\t\treturn mergeErr\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"conflicts resolved but commit failed: %w\", err)\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// MergeWithStrategy merges ref into the current branch and, when the merge\n// produces conflicts, resolves EVERY conflicted table with the operator's\n// explicit strategy (\"ours\" or \"theirs\") instead of aborting for later\n// resolution. It backs `bd vc merge --strategy` (#4992): the flag existed\n// and was documented, but the merge ran as a bare `CALL DOLT_MERGE` inside an\n// implicit autocommit transaction, so Dolt rejected any real conflict with\n// Error 1105 (\"@autocommit must be disabled ...\") before the strategy could\n// ever be applied — the strategy path was dead code.\n//\n// Unlike TryAutoResolveMergeConflicts (which only resolves conflict classes\n// proven safe without operator input, e.g. GH#2466 metadata), no allowlist\n// applies here: the operator named the strategy, so every conflicted table is","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/versioncontrolops/mergesettle.go#L207-L243","documentation":"In SettleMerge's strategy path, after conflicts are resolved with the operator's strategy, the settle concludes with `CALL DOLT_COMMIT('-m', ...)`. \"conflicts resolved but commit failed: %w\" wraps that commit's failure. The merge is aborted and the working set restored, so the resolution is not persisted — the pull must be retried after fixing the commit failure.","triggerScenarios":"DOLT_COMMIT refusing because the working set still violates constraints (FK repair was skipped or incomplete), no identity for the commit, the merge state having been closed, or a Dolt server error during commit.","commonSituations":"A merge carrying both resolvable conflicts and unrepairable FK violations in an ordering edge case; Dolt versions where DOLT_COMMIT requires additional flags; concurrent sessions invalidating the merge state between resolve and commit.","solutions":["Retry the pull after confirming no other session is using the database — the abort restored a clean state","Inspect the wrapped error: constraint-violation refusals mean resolve the remaining violations first (see dolt_constraint_violations)","Ensure the merge actually left repairable violations; run bd doctor to check schema consistency","Upgrade Dolt/bd if DOLT_COMMIT's argument handling differs in your version"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// after a failed strategy commit, verify no residual violations before retrying\nrows, err := db.QueryContext(ctx, \"SELECT `table` FROM dolt_constraint_violations WHERE num_violations > 0\")\n// if rows exist, repair them before re-running the merge","typeGuard":"func isCommitAfterResolveFailure(err error) bool {\n\treturn strings.Contains(err.Error(), \"conflicts resolved but commit failed\")\n}","tryCatchPattern":"err := versioncontrolops.MergeAndSettleWithStrategy(ctx, db, ref, strategy)\nif err != nil && isCommitAfterResolveFailure(err) {\n\ttime.Sleep(500 * time.Millisecond) // merge state was aborted; brief settle\n\terr = versioncontrolops.MergeAndSettleWithStrategy(ctx, db, ref, strategy)\n}","preventionTips":["Retry the pull once — the abort restored a clean working set","Ensure FK-cascade repairs completed; residual violations block DOLT_COMMIT","Avoid concurrent sessions on the same clone during pull","Keep Dolt versions current to avoid DOLT_COMMIT argument-handling issues"],"tags":["dolt","merge-conflicts","commit"],"backgroundTag":"merge-conflict-resolution-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}