{"record":{"id":"4be47e656a148325","repo":"temporalio/temporal","slug":"unable-to-delete-chasm-search-attributes-w","errorCode":null,"errorMessage":"unable to delete chasm search attributes: %w","messagePattern":"unable to delete chasm search attributes: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/persistence/sql/sqlplugin/mysql/visibility.go","lineNumber":210,"sourceCode":"\tdefer func() {\n\t\terr := tx.Rollback()\n\t\t// If the error is sql.ErrTxDone, it means the transaction already closed, so ignore error.\n\t\tif err != nil && !errors.Is(err, sql.ErrTxDone) {\n\t\t\t// Transaction rollback error should never happen, unless db connection was lost.\n\t\t\tretError = fmt.Errorf(\"transaction rollback failed: %w\", retError)\n\t\t}\n\t}()\n\t_, err = tx.NamedExecContext(ctx, templateDeleteCustomSearchAttributes, filter)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to delete custom search attributes: %w\", err)\n\t}\n\tresult, err = tx.NamedExecContext(ctx, templateDeleteWorkflowExecution_v8, filter)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to delete workflow execution: %w\", err)\n\t}\n\t_, err = tx.NamedExecContext(ctx, templateDeleteChasmSearchAttributes, filter)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to delete chasm search attributes: %w\", err)\n\t}\n\terr = tx.Commit()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result, nil\n}\n\n// SelectFromVisibility reads one or more rows from visibility table\nfunc (mdb *db) SelectFromVisibility(\n\tctx context.Context,\n\tfilter sqlplugin.VisibilitySelectFilter,\n) ([]sqlplugin.VisibilityRow, error) {\n\tif len(filter.Query) == 0 {\n\t\t// backward compatibility for existing tests\n\t\terr := sqlplugin.GenerateSelectQuery(&filter, mdb.converter.ToMySQLDateTime)\n\t\tif err != nil {\n\t\t\treturn nil, err","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/common/persistence/sql/sqlplugin/mysql/visibility.go#L192-L228","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run the visibility schema migrations that create the CHASM search attributes table.","Verify the DB user has DELETE privileges on all visibility tables.","Check the wrapped driver error for the specific cause (unknown table, access denied, connection lost).","Retry after transient connection/lock errors; the rollback guarantees a clean state."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Go: check chasm search attributes table exists\nSELECT COUNT(*) FROM information_schema.tables WHERE table_name = 'chasm_search_attributes';","typeGuard":null,"tryCatchPattern":"// Go\nif err := store.DeleteFromVisibility(ctx, req); err != nil {\n    if strings.Contains(err.Error(), \"chasm search attributes\") {\n        // likely missing migration: log schema version, alert\n        return err\n    }\n    return err\n}","preventionTips":["Always run migrations that accompany CHASM-enabled releases","Verify DB user permissions on newly created tables","Alert on 'unknown table' MySQL errno 1146 in logs","Test upgrades against a staging schema"],"tags":["mysql","database","delete","schema-migration","chasm"],"backgroundTag":"sql-query-failed","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}