temporalio/temporal · error

unable to delete chasm search attributes: %w

Error message

unable to delete chasm search attributes: %w

What it means

Returned when the DELETE on templateDeleteChasmSearchAttributes fails during DeleteFromVisibility. Like the other statements, failure triggers a full rollback of the transaction. The wrapped error contains the driver-level cause.

Source

Thrown at common/persistence/sql/sqlplugin/mysql/visibility.go:210

	defer func() {
		err := tx.Rollback()
		// If the error is sql.ErrTxDone, it means the transaction already closed, so ignore error.
		if err != nil && !errors.Is(err, sql.ErrTxDone) {
			// Transaction rollback error should never happen, unless db connection was lost.
			retError = fmt.Errorf("transaction rollback failed: %w", retError)
		}
	}()
	_, err = tx.NamedExecContext(ctx, templateDeleteCustomSearchAttributes, filter)
	if err != nil {
		return nil, fmt.Errorf("unable to delete custom search attributes: %w", err)
	}
	result, err = tx.NamedExecContext(ctx, templateDeleteWorkflowExecution_v8, filter)
	if err != nil {
		return nil, fmt.Errorf("unable to delete workflow execution: %w", err)
	}
	_, err = tx.NamedExecContext(ctx, templateDeleteChasmSearchAttributes, filter)
	if err != nil {
		return nil, fmt.Errorf("unable to delete chasm search attributes: %w", err)
	}
	err = tx.Commit()
	if err != nil {
		return nil, err
	}
	return result, nil
}

// SelectFromVisibility reads one or more rows from visibility table
func (mdb *db) SelectFromVisibility(
	ctx context.Context,
	filter sqlplugin.VisibilitySelectFilter,
) ([]sqlplugin.VisibilityRow, error) {
	if len(filter.Query) == 0 {
		// backward compatibility for existing tests
		err := sqlplugin.GenerateSelectQuery(&filter, mdb.converter.ToMySQLDateTime)
		if err != nil {
			return nil, err

View on GitHub (pinned to bde624efd1)

Solutions

  1. Run the visibility schema migrations that create the CHASM search attributes table.
  2. Verify the DB user has DELETE privileges on all visibility tables.
  3. Check the wrapped driver error for the specific cause (unknown table, access denied, connection lost).
  4. Retry after transient connection/lock errors; the rollback guarantees a clean state.
Defensive patterns

Strategy: retry

Validate before calling

// Go: check chasm search attributes table exists
SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 'chasm_search_attributes';

Try / catch

// Go
if err := store.DeleteFromVisibility(ctx, req); err != nil {
    if strings.Contains(err.Error(), "chasm search attributes") {
        // likely missing migration: log schema version, alert
        return err
    }
    return err
}

Prevention

When it happens

Trigger: DeleteFromVisibility when the CHASM search attributes delete errors — most commonly because the chasm search attributes table does not exist (schema predates the CHASM feature) or the connection dropped earlier in the transaction.

Common situations: Upgrading a cluster to a CHASM-enabled version without running the new visibility migrations; DB failover between statements; permission denied on the new table for the configured DB user.

Understand the failure class

Background: "query failed", "%w: SQL error" — wrapped database query errors in Go libraries explained — this error's family across 3 libraries.

Related errors


AI-assisted analysis of temporalio/temporal@bde624efd1 (2026-09-01). Data as JSON: /api/errors/4be47e656a148325. Report an issue: GitHub.