{"record":{"id":"9de202d3fb59103a","repo":"temporalio/temporal","slug":"w-expected-json-number-got-t-9de202","errorCode":null,"errorMessage":"%w: expected json.Number got %T","messagePattern":"%w: expected json\\.Number got %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/persistence/visibility/store/elasticsearch/visibility_store.go","lineNumber":1299,"sourceCode":"\t}\n\n\tswitch t {\n\tcase enumspb.INDEXED_VALUE_TYPE_TEXT,\n\t\tenumspb.INDEXED_VALUE_TYPE_KEYWORD,\n\t\tenumspb.INDEXED_VALUE_TYPE_KEYWORD_LIST,\n\t\tenumspb.INDEXED_VALUE_TYPE_DATETIME:\n\t\tstringVal, isString := val.(string)\n\t\tif !isString {\n\t\t\treturn nil, fmt.Errorf(\"%w: expected string got %T\", errUnexpectedJSONFieldType, val)\n\t\t}\n\t\tif t == enumspb.INDEXED_VALUE_TYPE_DATETIME {\n\t\t\treturn time.Parse(time.RFC3339Nano, stringVal)\n\t\t}\n\t\treturn stringVal, nil\n\tcase enumspb.INDEXED_VALUE_TYPE_INT, enumspb.INDEXED_VALUE_TYPE_DOUBLE:\n\t\tnumberVal, isNumber := val.(json.Number)\n\t\tif !isNumber {\n\t\t\treturn nil, fmt.Errorf(\"%w: expected json.Number got %T\", errUnexpectedJSONFieldType, val)\n\t\t}\n\t\tif t == enumspb.INDEXED_VALUE_TYPE_INT {\n\t\t\treturn numberVal.Int64()\n\t\t}\n\t\treturn numberVal.Float64()\n\tcase enumspb.INDEXED_VALUE_TYPE_BOOL:\n\t\tboolVal, isBool := val.(bool)\n\t\tif !isBool {\n\t\t\treturn nil, fmt.Errorf(\"%w: expected bool got %T\", errUnexpectedJSONFieldType, val)\n\t\t}\n\t\treturn boolVal, nil\n\t}\n\n\tpanic(fmt.Sprintf(\"Unknown field type: %v\", t))\n}\n\nfunc ConvertElasticsearchClientError(message string, err error, logger log.Logger) error {\n\t// This message is returned to client, avoiding including too much details.","sourceCodeStart":1281,"sourceCodeEnd":1317,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/common/persistence/visibility/store/elasticsearch/visibility_store.go#L1281-L1317","documentation":"Error \"%w: expected json.Number got %T\" thrown in temporalio/temporal.","triggerScenarios":"Thrown at common/persistence/visibility/store/elasticsearch/visibility_store.go:1299 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}