{"record":{"id":"f7ce2cf152b83eec","repo":"gastownhall/beads","slug":"resolve-s-conflicts-w","errorCode":null,"errorMessage":"resolve %s conflicts: %w","messagePattern":"resolve (.+?) conflicts: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/versioncontrolops/mergesettle.go","lineNumber":311,"sourceCode":"\tif len(conflicts) == 0 {\n\t\tif mergeErr != nil {\n\t\t\t// Not a conflict: some other merge failure (unknown branch, dirty\n\t\t\t// working set, ...). Nothing to resolve — surface it as-is.\n\t\t\tabortMerge(ctx, db, preMergeClean)\n\t\t\treturn nil, fmt.Errorf(\"merge branch %s: %w\", ref, mergeErr)\n\t\t}\n\t\treturn nil, nil\n\t}\n\n\tdirtyTables := make(map[string]bool, len(conflicts))\n\tfor _, c := range conflicts {\n\t\ttable := c.Field\n\t\tif table == \"\" {\n\t\t\ttable = \"issues\"\n\t\t}\n\t\tif err := ResolveConflicts(ctx, db, table, strategy); err != nil {\n\t\t\tabortMerge(ctx, db, preMergeClean)\n\t\t\treturn conflicts, fmt.Errorf(\"resolve %s conflicts: %w\", table, err)\n\t\t}\n\t\tdirtyTables[table] = true\n\t}\n\n\t// bd-6dnrw.4 / #4992: a strategy resolution can leave FK cascade\n\t// violations behind exactly like the auto-resolve path (e.g. --ours keeps\n\t// a child row whose parent was deleted on the other side); repair them the\n\t// same way so a strategy-resolved merge cannot silently commit a violated\n\t// working set.\n\trepaired, had, violErr := TryRepairFKCascadeViolations(ctx, db)\n\tif violErr != nil {\n\t\tabortMerge(ctx, db, preMergeClean)\n\t\treturn conflicts, violErr\n\t}\n\tif had && !repaired {\n\t\tabortMerge(ctx, db, preMergeClean)\n\t\treturn conflicts, fmt.Errorf(\"conflicts resolved with '%s' strategy but merge left constraint violations bd cannot auto-repair; inspect dolt_constraint_violations and resolve before retrying\", strategy)\n\t}","sourceCodeStart":293,"sourceCodeEnd":329,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/versioncontrolops/mergesettle.go#L293-L329","documentation":"After conflicts were detected, MergeWithStrategy calls ResolveConflicts per conflicted table with the chosen strategy (ours/theirs). If the per-table DOLT_CONFLICTS_RESOLVE call fails, the merge is aborted and this error reports which table could not be resolved.","triggerScenarios":"ResolveConflicts executes `CALL DOLT_CONFLICTS_RESOLVE('--ours'|'--theirs', table)` and Dolt returns an error — e.g. the table no longer has conflicts (already resolved), the table name is wrong, or the server rejects the call.","commonSituations":"A conflict row whose `table` field is empty mapped to 'issues' but the real conflicts are in another table; concurrent process already resolved the conflicts; Dolt version lacking DOLT_CONFLICTS_RESOLVE for the given mode.","solutions":["Check the wrapped inner error for the exact Dolt message","Run `SELECT * FROM dolt_conflicts` to see which tables actually have conflicts, then resolve manually with CALL DOLT_CONFLICTS_RESOLVE","Ensure only one process settles the merge at a time (lock/serialize merges)","Upgrade Dolt if DOLT_CONFLICTS_RESOLVE is unsupported"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"rows, err := db.QueryContext(ctx, \"SELECT \\\"table\\\" FROM dolt_conflicts\")\nif err == nil {\n    for rows.Next() { /* confirm expected tables have conflicts before settling */ }\n    rows.Close()\n}","typeGuard":null,"tryCatchPattern":"conflicts, err := MergeWithStrategy(ctx, db, ref, strategy, author)\nif err != nil && strings.Contains(err.Error(), \"resolve \") {\n    // per-table resolve failed; fall back to manual\n    // CALL DOLT_CONFLICTS_RESOLVE('--ours', '<table>') per conflicted table\n}","preventionTips":["Only one settle process at a time (file/DB lock)","Match strategy to table semantics (config=theirs, issues=field merge)","Test merges on a staging clone before production"],"tags":["dolt","merge","conflict-resolution"],"backgroundTag":"dolt-conflict-resolution-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}