temporalio/temporal · error

value %s is not a string value

Error message

value %s is not a string value

What it means

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.

Source

Thrown at common/sqlquery/query.go:39

	if err == nil {
		return timestamp.UnixOrZeroTime(ts), nil
	}
	timestampStr, err := ExtractStringValue(timeStr)
	if err != nil {
		return time.Time{}, err
	}
	parsedTime, err := time.Parse(DefaultDateTimeFormat, timestampStr)
	if err != nil {
		return time.Time{}, err
	}
	return parsedTime, nil
}

func ExtractStringValue(s string) (string, error) {
	if len(s) >= 2 && s[0] == '\'' && s[len(s)-1] == '\'' {
		return s[1 : len(s)-1], nil
	}
	return "", fmt.Errorf("value %s is not a string value", s)
}

func ExtractIntValue(s string) (int, error) {
	intValue, err := strconv.Atoi(s)
	if err != nil {
		return 0, err
	}
	return intValue, nil
}

// ParseValue returns a string, int64 or float64 if the parsing succeeds.
func ParseValue(sqlValue string) (any, error) {
	if sqlValue == "" {
		return "", nil
	}

	if sqlValue[0] == '\'' && sqlValue[len(sqlValue)-1] == '\'' {
		strValue := strings.Trim(sqlValue, "'")

View on GitHub (pinned to bde624efd1)

Solutions

  1. Wrap string literals in single quotes in the query: WHERE WorkflowType = 'MyWorkflow'.
  2. Validate/normalize the query's comparison operands before calling ConvertSQLQueryToCommonQuery.
  3. Use the right extractor for the token type: ExtractIntValue for numbers, ConvertToTime for datetimes.

Example fix

// before
query := "WHERE ExecutionStatus = Running"
// after
query := "WHERE ExecutionStatus = 'Running'"
Defensive patterns

Strategy: validation

Validate before calling

if !(len(tok) >= 2 && tok[0] == '\'' && tok[len(tok)-1] == '\'') {
    return fmt.Errorf("operand %q must be a single-quoted string literal", tok)
}

Try / catch

if strings.Contains(err.Error(), "is not a string value") { /* suggest quoting the literal */ }

Prevention

When it happens

Trigger: Converting a visibility SQL query whose comparison operand is a bare token, e.g. WHERE WorkflowType = MyWorkflow (unquoted) instead of WHERE WorkflowType = 'MyWorkflow'.

Common situations: 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.

Related errors


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