gastownhall/beads · error

query schema conflicts: %w

Error message

query schema conflicts: %w

What it means

schemaConflictTables lists tables with schema-level conflicts from dolt_schema_conflicts; this error wraps any query failure that is NOT the table being missing (absence is intentionally treated as 'no schema conflicts'). It means the merge-blocker diagnostic could not read schema conflict state.

Source

Thrown at internal/storage/versioncontrolops/conflicts.go:498

	err := db.QueryRowContext(ctx, "SELECT is_merging FROM dolt_merge_status").Scan(&merging)
	if err != nil {
		if isMissingSystemTable(err) || errors.Is(err, sql.ErrNoRows) {
			return false, nil
		}
		return false, fmt.Errorf("query merge status: %w", err)
	}
	return merging, nil
}

// schemaConflictTables lists the tables whose SCHEMAS conflict — dolt keeps
// them out of dolt_conflicts entirely, so totalConflicts cannot see them.
func schemaConflictTables(ctx context.Context, db DBConn) ([]string, error) {
	rows, err := db.QueryContext(ctx, "SELECT table_name FROM dolt_schema_conflicts")
	if err != nil {
		if isMissingSystemTable(err) {
			return nil, nil
		}
		return nil, fmt.Errorf("query schema conflicts: %w", err)
	}
	defer func() { _ = rows.Close() }()
	var tables []string
	for rows.Next() {
		var t string
		if err := rows.Scan(&t); err != nil {
			return nil, fmt.Errorf("scan schema conflict: %w", err)
		}
		tables = append(tables, t)
	}
	if err := rows.Err(); err != nil {
		return nil, fmt.Errorf("iterate schema conflicts: %w", err)
	}
	return tables, nil
}

// constraintViolationCounts lists the tables carrying outstanding constraint
// violations. mergesettle.go repairs the FK-cascade class on the auto path;

View on GitHub (pinned to 71377f2769)

Solutions

  1. Read the wrapped cause: fix connectivity or grant SELECT on dolt_schema_conflicts to the connecting user.
  2. If the error indicates an unknown column, align the dolt engine version with bd's expectations.
  3. Retry the diagnosis after the merge state stabilizes; mid-merge engine errors are often transient.
  4. As a fallback, inspect schema conflicts directly in the repo with dolt's own conflicts commands.

Example fix

// before: hard-failing the command on a diagnosis query
blockers, err := ops.GetMergeBlockers(ctx, db)
if err != nil { return err }
// after: log partial errors and use readable blockers
blockers, err := ops.GetMergeBlockers(ctx, db)
if err != nil { log.Printf("partial diagnosis: %v", err) }
use(blockers.SchemaConflictTables)
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify access to the schema conflicts table first:
rows, err := db.QueryContext(ctx, "SELECT table_name FROM dolt_schema_conflicts")
if err != nil && !missingTable(err) {
  // diagnose connectivity/permissions before the full check
}

Try / catch

blockers, err := ops.GetMergeBlockers(ctx, db)
if err != nil {
  if strings.Contains(err.Error(), "query schema conflicts") {
    log.Printf("schema conflicts unreadable: %v", err) // use partial results
  } else { return err }
}

Prevention

When it happens

Trigger: GetMergeBlockers querying dolt_schema_conflicts and receiving a non-missing-table SQL error: connection failure, permission denial, engine error while a merge is open, or a dolt version where the table exists with a different layout (e.g. no table_name column).

Common situations: Older dolt versions reporting a different error than 'table not found'; revoked privileges on dolt_* system tables in server mode; transient server disconnects during a long merge session.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/6efe7b912bb87e4a. Report an issue: GitHub.