{"record":{"id":"d2536f9701f92126","repo":"temporalio/temporal","slug":"value-s-is-not-a-string-value","errorCode":null,"errorMessage":"value %s is not a string value","messagePattern":"value (.+?) is not a string value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/sqlquery/query.go","lineNumber":39,"sourceCode":"\tif err == nil {\n\t\treturn timestamp.UnixOrZeroTime(ts), nil\n\t}\n\ttimestampStr, err := ExtractStringValue(timeStr)\n\tif err != nil {\n\t\treturn time.Time{}, err\n\t}\n\tparsedTime, err := time.Parse(DefaultDateTimeFormat, timestampStr)\n\tif err != nil {\n\t\treturn time.Time{}, err\n\t}\n\treturn parsedTime, nil\n}\n\nfunc ExtractStringValue(s string) (string, error) {\n\tif len(s) >= 2 && s[0] == '\\'' && s[len(s)-1] == '\\'' {\n\t\treturn s[1 : len(s)-1], nil\n\t}\n\treturn \"\", fmt.Errorf(\"value %s is not a string value\", s)\n}\n\nfunc ExtractIntValue(s string) (int, error) {\n\tintValue, err := strconv.Atoi(s)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn intValue, nil\n}\n\n// ParseValue returns a string, int64 or float64 if the parsing succeeds.\nfunc ParseValue(sqlValue string) (any, error) {\n\tif sqlValue == \"\" {\n\t\treturn \"\", nil\n\t}\n\n\tif sqlValue[0] == '\\'' && sqlValue[len(sqlValue)-1] == '\\'' {\n\t\tstrValue := strings.Trim(sqlValue, \"'\")","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/common/sqlquery/query.go#L21-L57","documentation":"ExtractStringValue in common/sqlquery parses a SQL string literal from a query token and errors when the token is not wrapped in single quotes. Callers (convertComparisonExpr, ConvertToTime, evaluateComparison) use it to pull literal values out of a parsed SQL-ish query; an unquoted token is not a valid string literal, so conversion fails with this message.","triggerScenarios":"Converting a visibility SQL query whose comparison operand is a bare token, e.g. WHERE WorkflowType = MyWorkflow (unquoted) instead of WHERE WorkflowType = 'MyWorkflow'.","commonSituations":"Hand-written or generated ListWorkflowExecutions queries missing quotes around string literals; quoting style confusion (double quotes or backticks instead of single quotes) from users used to other SQL dialects.","solutions":["Wrap string literals in single quotes in the query: WHERE WorkflowType = 'MyWorkflow'.","Validate/normalize the query's comparison operands before calling ConvertSQLQueryToCommonQuery.","Use the right extractor for the token type: ExtractIntValue for numbers, ConvertToTime for datetimes."],"exampleFix":"// before\nquery := \"WHERE ExecutionStatus = Running\"\n// after\nquery := \"WHERE ExecutionStatus = 'Running'\"","handlingStrategy":"validation","validationCode":"if !(len(tok) >= 2 && tok[0] == '\\'' && tok[len(tok)-1] == '\\'') {\n    return fmt.Errorf(\"operand %q must be a single-quoted string literal\", tok)\n}","typeGuard":null,"tryCatchPattern":"if strings.Contains(err.Error(), \"is not a string value\") { /* suggest quoting the literal */ }","preventionTips":["Always single-quote string literals in visibility SQL queries","Validate query syntax before calling ConvertSQLQueryToCommonQuery","Use the correct extractor per operand type (string/int/datetime)"],"tags":["go","sql-query","visibility","query-syntax"],"backgroundTag":"invalid-sql-literal","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}