{"record":{"id":"9cd90afd81df24ab","repo":"gastownhall/beads","slug":"query-merge-status-w","errorCode":null,"errorMessage":"query merge status: %w","messagePattern":"query merge status: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/versioncontrolops/conflicts.go","lineNumber":485,"sourceCode":"\t} else {\n\t\tout.ConstraintViolations = violations\n\t}\n\t// Partial results are still useful — the caller gets what was readable\n\t// plus the reason the rest was not.\n\treturn out, errors.Join(errs...)\n}\n\n// mergeInProgress reads dolt_merge_status.is_merging: true between a halted\n// DOLT_MERGE and its concluding commit. It is what lets `--conclude` tell\n// \"resolved but uncommitted\" apart from \"nothing to conclude\".\nfunc mergeInProgress(ctx context.Context, db DBConn) (bool, error) {\n\tvar merging bool\n\terr := db.QueryRowContext(ctx, \"SELECT is_merging FROM dolt_merge_status\").Scan(&merging)\n\tif err != nil {\n\t\tif isMissingSystemTable(err) || errors.Is(err, sql.ErrNoRows) {\n\t\t\treturn false, nil\n\t\t}\n\t\treturn false, fmt.Errorf(\"query merge status: %w\", err)\n\t}\n\treturn merging, nil\n}\n\n// schemaConflictTables lists the tables whose SCHEMAS conflict — dolt keeps\n// them out of dolt_conflicts entirely, so totalConflicts cannot see them.\nfunc schemaConflictTables(ctx context.Context, db DBConn) ([]string, error) {\n\trows, err := db.QueryContext(ctx, \"SELECT table_name FROM dolt_schema_conflicts\")\n\tif err != nil {\n\t\tif isMissingSystemTable(err) {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn nil, fmt.Errorf(\"query schema conflicts: %w\", err)\n\t}\n\tdefer func() { _ = rows.Close() }()\n\tvar tables []string\n\tfor rows.Next() {\n\t\tvar t string","sourceCodeStart":467,"sourceCodeEnd":503,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/versioncontrolops/conflicts.go#L467-L503","documentation":"mergeInProgress queries the dolt system table dolt_merge_status for is_merging; this error wraps any failure other than the table being absent or empty (those are treated as 'not merging'). It surfaces when the GetMergeBlockers diagnostic cannot read merge state at all.","triggerScenarios":"GetMergeBlockers run against a database where dolt_merge_status exists but the query fails: SQL error from the embedded engine or sql-server, corrupted/locked merge state, permission denial, or a dolt version where dolt_merge_status lacks the is_merging column.","commonSituations":"Pointing bd at a non-dolt MySQL database (schema drift); an old or newer dolt version with a changed system-table layout; a hung merge holding locks on the status table.","solutions":["Check the wrapped cause: if it is 'unknown column is_merging', align the dolt engine version with what bd expects.","Verify you are connected to a dolt database, not plain MySQL, and that it is not mid-migration.","Restart the dolt sql-server (or reopen the embedded DB) to release locks, then rerun the blocker check.","If persistent, file an issue with the wrapped error text — the helper tolerates missing tables but not broken ones."],"exampleFix":"// before: treating any failure as fatal\nblockers, err := ops.GetMergeBlockers(ctx, db)\nif err != nil { return err }\n// after: distinguish version drift from transient failure\nif strings.Contains(err.Error(), \"is_merging\") {\n  log.Printf(\"dolt version drift: %v — check engine compatibility\", err)\n} else if isTransient(err) {\n  blockers, err = retryMergeBlockers(ctx, db)\n}","handlingStrategy":"try-catch","validationCode":"// Pre-check that the merge status table is queryable:\nvar merging bool\nerr := db.QueryRowContext(ctx, \"SELECT is_merging FROM dolt_merge_status\").Scan(&merging)\nif err != nil && !missingTable(err) && !errors.Is(err, sql.ErrNoRows) {\n  // degraded diagnosis; warn or skip before calling GetMergeBlockers\n}","typeGuard":null,"tryCatchPattern":"blockers, err := ops.GetMergeBlockers(ctx, db)\nif err != nil {\n  if strings.Contains(err.Error(), \"query merge status\") {\n    log.Printf(\"merge status unreadable, continuing with partial blockers: %v\", err)\n  } else { return err }\n}","preventionTips":["Pin a dolt engine version compatible with bd's expected system-table schema.","Confirm you're connected to a dolt database, not vanilla MySQL.","Restart a wedged dolt sql-server before running merge diagnostics."],"tags":["dolt","merge-status","system-table","diagnostics"],"backgroundTag":"dolt-system-table-unavailable","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}