{"record":{"id":"afc79c15faf2ba29","repo":"temporalio/temporal","slug":"unsupported-type-for-visibilitysearchattributes","errorCode":null,"errorMessage":"unsupported type for VisibilitySearchAttributes: %T","messagePattern":"unsupported type for VisibilitySearchAttributes: %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/persistence/sql/sqlplugin/visibility.go","lineNumber":128,"sourceCode":"\t}\n)\n\nvar _ sql.Scanner = (*VisibilitySearchAttributes)(nil)\nvar _ driver.Valuer = (*VisibilitySearchAttributes)(nil)\n\nvar DbFields = getDbFields()\n\nfunc (vsa *VisibilitySearchAttributes) Scan(src any) error {\n\tif src == nil {\n\t\treturn nil\n\t}\n\tswitch v := src.(type) {\n\tcase []byte:\n\t\treturn json.Unmarshal(v, &vsa)\n\tcase string:\n\t\treturn json.Unmarshal([]byte(v), &vsa)\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported type for VisibilitySearchAttributes: %T\", v)\n\t}\n}\n\nfunc (vsa VisibilitySearchAttributes) Value() (driver.Value, error) {\n\tif vsa == nil {\n\t\treturn nil, nil\n\t}\n\tbs, err := json.Marshal(vsa)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn string(bs), nil\n}\n\ntype dbRowsIf interface {\n\tNext() bool\n\tScan(...any) error\n\tClose() error","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/common/persistence/sql/sqlplugin/visibility.go#L110-L146","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"// Go: confirm driver returns []byte/string for JSON columns\nrows, _ := db.Query(\"SELECT search_attributes FROM executions_visibility LIMIT 1\")\n// inspect column_type via driver rows.Columns()/column types before wide rollout","typeGuard":null,"tryCatchPattern":"// Go\nif err != nil && strings.Contains(err.Error(), \"unsupported type for VisibilitySearchAttributes\") {\n    return fmt.Errorf(\"driver returned unexpected type for search attributes column: %w\", err)\n}","preventionTips":["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"],"tags":["scan","driver","search-attributes","json","type-mismatch"],"backgroundTag":"unsupported-scan-type","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}