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() error

View on GitHub (pinned to bde624efd1)

Solutions

  1. Check which driver is in use and ensure it returns []byte or string for JSON columns.
  2. Verify the search attributes column type in the schema matches the expected JSON/text/blob type.
  3. If using a custom driver wrapper, make it produce []byte for JSON values.
  4. 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

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


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