gastownhall/beads · error

check issue existence in %s: scan: %w

Error message

check issue existence in %s: scan: %w

What it means

PresentIssueOrWispIDsInTx failed while scanning a row of the existence probe (SELECT id FROM <table> WHERE id IN (...)) into a string. The scan error is wrapped with the table name and rows are closed before returning to avoid leaking the connection.

Source

Thrown at internal/storage/issueops/edges.go:164

			placeholders := make([]string, len(batch))
			args := make([]any, len(batch))
			for i, id := range batch {
				placeholders[i] = "?"
				args[i] = id
			}
			rows, err := tx.QueryContext(ctx, fmt.Sprintf(
				"SELECT id FROM %s WHERE id IN (%s)", table, strings.Join(placeholders, ",")), args...)
			if err != nil {
				if isTableNotExistError(err) {
					break
				}
				return nil, fmt.Errorf("check issue existence in %s: %w", table, err)
			}
			for rows.Next() {
				var id string
				if scanErr := rows.Scan(&id); scanErr != nil {
					_ = rows.Close()
					return nil, fmt.Errorf("check issue existence in %s: scan: %w", table, scanErr)
				}
				present[id] = struct{}{}
			}
			_ = rows.Close()
			if err := rows.Err(); err != nil {
				return nil, fmt.Errorf("check issue existence in %s: rows: %w", table, err)
			}
		}
	}
	return present, nil
}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Read the wrapped scan error — it names the column and Go type mismatch.
  2. Ensure the id column is NOT NULL VARCHAR in both issues and wisps.
  3. Pin a supported driver version whose string mapping is stable.
  4. If the query was customized, re-align the SELECT list with the single-string Scan.
Defensive patterns

Strategy: try-catch

Try / catch

res, err := ExecuteEdgeRead(ctx, tx, req)
if err != nil && strings.Contains(err.Error(), "check issue existence in ") && strings.Contains(err.Error(), ": scan: ") {
	log.Errorf("existence probe scan failure: %v", err)
}

Prevention

When it happens

Trigger: The issues/wisps id column returning a value that cannot scan into string (NULL id from an unusual schema, wrong column type, or a customized query whose SELECT list no longer matches the single string scan).

Common situations: A schema variant where id is nullable; a non-Dolt driver with different type mappings; hand-edited code selecting additional columns while the scan still expects one.

Related errors


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