temporalio/temporal · error
unable to upsert chasm search attributes: %w
Error message
unable to upsert chasm search attributes: %w
What it means
The final statement in the ReplaceIntoVisibility transaction — the upsert into the CHASM search attributes table — failed, wrapped as 'unable to upsert chasm search attributes'. The transaction rolls back so no partial visibility state is written. Like the insert counterpart, this most often means the visibility store schema is missing the CHASM table introduced with CHASM visibility support.
Source
Thrown at common/persistence/sql/sqlplugin/mysql/visibility.go:166
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)
}
}()
result, err = tx.NamedExecContext(ctx, templateUpsertWorkflowExecution, finalRow)
if err != nil {
return nil, fmt.Errorf("unable to upsert workflow execution: %w", err)
}
_, err = tx.NamedExecContext(ctx, templateUpsertCustomSearchAttributes, finalRow)
if err != nil {
return nil, fmt.Errorf("unable to upsert custom search attributes: %w", err)
}
_, err = tx.NamedExecContext(ctx, templateUpsertChasmSearchAttributes, finalRow)
if err != nil {
return nil, fmt.Errorf("unable to upsert chasm search attributes: %w", err)
}
err = tx.Commit()
if err != nil {
return nil, err
}
return result, nil
}
// DeleteFromVisibility deletes a row from visibility table if it exist
func (mdb *db) DeleteFromVisibility(
ctx context.Context,
filter sqlplugin.VisibilityDeleteFilter,
) (result sql.Result, retError error) {
defer func() {
retError = mdb.handle.ConvertError(retError)
}()
db, err := mdb.handle.DB()
if err != nil {View on GitHub (pinned to bde624efd1)
Solutions
- Unwrap the cause: 'Table temporal_visibility.visibility_chasm_search_attributes doesn't exist' means run schema migrations.
- Apply the latest visibility schema: temporal-sql-tool update-schema -d temporal_visibility.
- Verify the deployed server binary and visibility schema version are compatible.
- If constraint-related, inspect the VisibilityRow chasm fields for consistency.
- Retry after confirming DB connectivity if the cause is a connection error.
Example fix
// before: old schema, CHASM table missing // after temporal-sql-tool -plugin mysql -ep $DB_HOST -u $DB_USER -p $DB_PWD update-schema -d temporal_visibility
Defensive patterns
Strategy: validation
Validate before calling
// Go: verify CHASM table exists at startup
var cnt int
if err := visDB.GetContext(ctx, &cnt,
"SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 'visibility_chasm_search_attributes'"); err != nil || cnt == 0 {
logger.Fatal("visibility schema missing CHASM tables; run update-schema")
} Try / catch
if err := db.ReplaceIntoVisibility(ctx, row); err != nil {
if strings.Contains(err.Error(), "unable to upsert chasm search attributes") {
logger.Error("chasm SA upsert failed; likely visibility schema drift", tag.Error(err))
return convertPersistenceErr(err)
}
return err
} Prevention
- Run visibility schema update-schema as part of every deployment/upgrade runbook.
- Include the CHASM table existence check in startup readiness checks.
- Keep environments (dev/staging/prod) on identical visibility schema versions.
When it happens
Trigger: ReplaceIntoVisibility: templateUpsertChasmSearchAttributes NamedExecContext fails — visibility_chasm_search_attributes table absent (old schema), constraint violation on chasm fields, or connection loss before commit.
Common situations: Server upgraded to a CHASM-enabled release without visibility schema migration; stale visibility DB in test/staging environments; conflicting chasm attribute rows during upsert.
Related errors
- unable to insert chasm search attributes: %w
- unable to upsert workflow execution: %w
- unable to insert workflow execution: %w
- unable to insert custom search attributes: %w
- unable to upsert custom search attributes: %w
AI-assisted analysis of temporalio/temporal@bde624efd1 (2026-09-01).
Data as JSON: /api/errors/baa8220f6ab32efe.
Report an issue: GitHub.