{"record":{"id":"45ea320601dc05e5","repo":"gastownhall/beads","slug":"failed-to-set-dolt-allow-commit-conflicts-w","errorCode":null,"errorMessage":"failed to set dolt_allow_commit_conflicts: %w","messagePattern":"failed to set dolt_allow_commit_conflicts: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/dolt/store.go","lineNumber":4376,"sourceCode":"\t// pull/merge path, and a merge landing on the wrong branch has a much\n\t// larger blast radius than a stale is_blocked flag, so it needs its own\n\t// regression test asserting the merge target rather than riding an\n\t// unrelated TDD cycle. Tracked as be-5ybd, which covers all three call\n\t// sites. The fix is s.pinStoreBranch(ctx, db) before BeginTx below.\n\tdb, err := s.openLongTimeoutConn()\n\tif err != nil {\n\t\treturn pullReport{}, err\n\t}\n\tdefer db.Close()\n\ttx, err := db.BeginTx(ctx, nil)\n\tif err != nil {\n\t\treturn pullReport{}, fmt.Errorf(\"failed to begin transaction: %w\", err)\n\t}\n\n\t// Allow commits with conflicts so we can inspect and resolve them.\n\tif _, err := tx.ExecContext(ctx, \"SET @@dolt_allow_commit_conflicts = 1\"); err != nil {\n\t\t_ = tx.Rollback()\n\t\treturn pullReport{}, fmt.Errorf(\"failed to set dolt_allow_commit_conflicts: %w\", err)\n\t}\n\t// bd-6dnrw.4: a merge that violates a foreign key (e.g. one clone deleted\n\t// an issue while another inserted a child row referencing it) rolls the\n\t// whole transaction back before it can be inspected. Let it land in the\n\t// working set instead so tryRepairFKCascadeViolations can apply the\n\t// cascade semantics; the violation check before tx.Commit() below refuses\n\t// to commit anything the repair did not fully clear.\n\tif _, err := tx.ExecContext(ctx, \"SET @@dolt_force_transaction_commit = 1\"); err != nil {\n\t\t_ = tx.Rollback()\n\t\treturn pullReport{}, fmt.Errorf(\"failed to set dolt_force_transaction_commit: %w\", err)\n\t}\n\n\t// DOLT_PULL's row is the engine's only in-band account of what the pull\n\t// did: `dolt pull` on the CLI exits 0 whether it merged or was already up\n\t// to date, and so does this CALL. Capturing it costs nothing — the drain\n\t// is identical — and it is the difference between a caller that knows\n\t// nothing arrived and one that only knows no error occurred (ga-bq9zd).\n\tpullRow, pullErr := schema.CallReturningRow(ctx, tx, query, args...)","sourceCodeStart":4358,"sourceCodeEnd":4394,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/dolt/store.go#L4358-L4394","documentation":"Inside the pull transaction, the store sets @@dolt_allow_commit_conflicts = 1 so a merge that hits conflicts can be inspected and auto-resolved instead of aborting. This error means that SET statement failed; the transaction is rolled back and the pull aborts before fetching/merging.","triggerScenarios":"The Dolt server does not recognize the dolt_allow_commit_conflicts system variable (older Dolt version, or connected to a non-Dolt MySQL server); or the session/transaction was killed between BeginTx and the SET (timeout, server restart).","commonSituations":"Upgrading/relocating the store to a server running an older Dolt without that variable; accidentally pointing the DSN at plain MySQL or MariaDB instead of dolt sql-server; permissions restricting SET of system variables; transient connection drop on a flaky network.","solutions":["Verify the endpoint is a Dolt sql-server and its version supports dolt_allow_commit_conflicts (SELECT @@dolt_allow_commit_conflicts).","Upgrade Dolt/dolt sql-server to a current version if the variable is unknown.","Confirm the DSN targets the dolt server, not a plain MySQL instance sharing the port.","Re-run the pull if the cause was a transient kill/timeout.","Check server logs for session errors at the time of the SET."],"exampleFix":"// before\n// DSN pointed at mysql://localhost:3306 (plain MySQL)\n// after\n// DSN pointed at the dolt sql-server:\nBEADS_DB=\"root:@tcp(localhost:3307)/bd\" // dolt sql-server, supports @@dolt_allow_commit_conflicts","handlingStrategy":"validation","validationCode":"var v string\nif err := db.QueryRow(\"SELECT @@dolt_allow_commit_conflicts\").Scan(&v); err != nil {\n    return fmt.Errorf(\"server lacks dolt_allow_commit_conflicts support: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := store.Pull(ctx); err != nil {\n    if strings.Contains(err.Error(), \"dolt_allow_commit_conflicts\") {\n        // wrong server or old Dolt — fail fast, do not retry blindly\n        return fmt.Errorf(\"endpoint does not support dolt pull session vars: %w\", err)\n    }\n    return err\n}","preventionTips":["Pin/verify the Dolt server version in deployment before upgrading beads.","Ensure the DSN targets dolt sql-server, never a shared MySQL port.","Probe @@dolt_allow_commit_conflicts once at startup as a compat gate.","Watch server logs for session kills if the error appears intermittently."],"tags":["dolt","sql","configuration","version-compat"],"backgroundTag":"unknown-system-variable","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}