gastownhall/beads · error

scan status: %w

Error message

scan status: %w

What it means

Status wraps a failed rows.Scan into (tableName string, staged bool, statusStr string) as "scan status: <underlying>". The library throws it because a row returned by dolt_status did not match the expected three-column shape or types. Since dolt_status's schema is fixed by the Dolt engine, this usually indicates a Dolt version whose dolt_status columns differ, or a NULL value where a string is expected.

Source

Thrown at internal/storage/versioncontrolops/version_control.go:34

// Status returns the current Dolt working set status (staged and unstaged changes).
func Status(ctx context.Context, db DBConn) (*storage.Status, error) {
	rows, err := db.QueryContext(ctx, "SELECT table_name, staged, status FROM dolt_status")
	if err != nil {
		return nil, fmt.Errorf("get status: %w", err)
	}
	defer rows.Close()

	status := &storage.Status{
		Staged:   make([]storage.StatusEntry, 0),
		Unstaged: make([]storage.StatusEntry, 0),
	}

	for rows.Next() {
		var tableName string
		var staged bool
		var statusStr string
		if err := rows.Scan(&tableName, &staged, &statusStr); err != nil {
			return nil, fmt.Errorf("scan status: %w", err)
		}
		entry := storage.StatusEntry{Table: tableName, Status: statusStr}
		if staged {
			status.Staged = append(status.Staged, entry)
		} else {
			status.Unstaged = append(status.Unstaged, entry)
		}
	}
	return status, rows.Err()
}

// Log returns recent commit history up to limit entries.
// If limit is 0 or negative, all entries are returned.
func Log(ctx context.Context, db DBConn, limit int) ([]storage.CommitInfo, error) {
	var query string
	var args []interface{}
	if limit > 0 {
		query = "SELECT commit_hash, committer, email, date, message FROM dolt_log ORDER BY date DESC LIMIT ?"

View on GitHub (pinned to 71377f2769)

Solutions

  1. Check the installed Dolt engine version against the one the library was built for; align versions.
  2. Run SELECT table_name, staged, status FROM dolt_status manually to inspect actual column names/types.
  3. If columns drifted, pin the engine to a supported version rather than editing this query locally.
  4. Look at the wrapped error text (e.g. 'converting NULL to string is unsupported') to identify which column/row misbehaves.

Example fix

// before
// engine v0.9 schema: (staged, table_name, status) — scan mismatch
var tableName string; var staged bool; var statusStr string
rows.Scan(&tableName, &staged, &statusStr)
// after
// pin the supported Dolt engine version so dolt_status is (table_name, staged, status)
rows.Scan(&tableName, &staged, &statusStr) // now matches
Defensive patterns

Strategy: validation

Validate before calling

// probe dolt_status shape once at startup
rows, err := db.QueryContext(ctx, "SELECT table_name, staged, status FROM dolt_status LIMIT 1")
if err != nil { return fmt.Errorf("dolt_status incompatible: %w", err) }
rows.Close()

Try / catch

st, err := versioncontrolops.Status(ctx, db)
if err != nil && strings.HasPrefix(err.Error(), "scan status") {
    return fmt.Errorf("dolt_status schema drifted; check Dolt engine version: %w", err)
}

Prevention

When it happens

Trigger: A Dolt engine version returns dolt_status with different column order/types; a row contains NULL in table_name or status; the driver returns a type Go's Scan cannot convert into string/bool (e.g. status as []byte with unexpected encoding).

Common situations: Upgrading or downgrading the embedded Dolt engine so the dolt_status schema drifts; mixing driver versions (go-sql-driver/mysql) incompatible with the engine's result encoding.

Related errors


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