temporalio/temporal · error
unsupported type for VisibilitySearchAttributes: %T
Error message
unsupported type for VisibilitySearchAttributes: %T
What it means
Returned by VisibilitySearchAttributes.Scan (implementing sql.Scanner) when the driver hands it a value that is neither []byte nor string. The visibility store only knows how to unmarshal JSON from those two shapes, so any other driver.Value type is rejected with the type name included.
Source
Thrown at common/persistence/sql/sqlplugin/visibility.go:128
}
)
var _ sql.Scanner = (*VisibilitySearchAttributes)(nil)
var _ driver.Valuer = (*VisibilitySearchAttributes)(nil)
var DbFields = getDbFields()
func (vsa *VisibilitySearchAttributes) Scan(src any) error {
if src == nil {
return nil
}
switch v := src.(type) {
case []byte:
return json.Unmarshal(v, &vsa)
case string:
return json.Unmarshal([]byte(v), &vsa)
default:
return fmt.Errorf("unsupported type for VisibilitySearchAttributes: %T", v)
}
}
func (vsa VisibilitySearchAttributes) Value() (driver.Value, error) {
if vsa == nil {
return nil, nil
}
bs, err := json.Marshal(vsa)
if err != nil {
return nil, err
}
return string(bs), nil
}
type dbRowsIf interface {
Next() bool
Scan(...any) error
Close() errorView on GitHub (pinned to bde624efd1)
Solutions
- Check which driver is in use and ensure it returns []byte or string for JSON columns.
- Verify the search attributes column type in the schema matches the expected JSON/text/blob type.
- If using a custom driver wrapper, make it produce []byte for JSON values.
- Inspect the %T in the message to identify the offending type and its source.
Defensive patterns
Strategy: type-guard
Validate before calling
// Go: confirm driver returns []byte/string for JSON columns
rows, _ := db.Query("SELECT search_attributes FROM executions_visibility LIMIT 1")
// inspect column_type via driver rows.Columns()/column types before wide rollout Try / catch
// Go
if err != nil && strings.Contains(err.Error(), "unsupported type for VisibilitySearchAttributes") {
return fmt.Errorf("driver returned unexpected type for search attributes column: %w", err)
} Prevention
- Use the standard drivers the plugin ships with (go-sqlite3, go-sql-driver/mysql, lib/pq)
- Keep the search attributes column as JSON/text/blob per schema definitions
- Avoid driver wrappers that alter scan behavior
- Test row scanning with your exact driver version in CI
When it happens
Trigger: Reading a visibility row where the search-attributes column comes back as an unexpected driver type — typically when a custom/replaced DB driver returns e.g. json.RawMessage, time.Time, or nil-typed variants instead of []byte/string, or when the column type changed in the schema.
Common situations: Using non-standard sqlite/MySQL drivers or middleware that changes result scanning behavior; schema changes altering the column type; ORM interposition on the raw scan path.
Related errors
- %w: %T (expected string)
- %w: %T (expected string)
- %w: invalid item value type in KeywordList value (got: %T, e
- unexpected return type of decodeValueTyped (got: %T, expecte
- requires a StartTime or CloseTime
AI-assisted analysis of temporalio/temporal@bde624efd1 (2026-09-01).
Data as JSON: /api/errors/afc79c15faf2ba29.
Report an issue: GitHub.