temporalio/temporal · error
invalid value for %s: %s
Error message
invalid value for %s: %s
What it means
The SearchPrecision value must be exactly one of the constants Day, Hour, Minute, or Second. Any other string (wrong case, plural, empty) fails the switch in convertComparisonExpr and returns this error.
Source
Thrown at common/archiver/s3store/query_parser.go:185
parsedQuery.startTime = ×tamp
case SearchPrecision:
val, err := sqlquery.ExtractStringValue(valStr)
if err != nil {
return err
}
if op != "=" {
return fmt.Errorf("only operation = is support for %s", SearchPrecision)
}
if parsedQuery.searchPrecision != nil && *parsedQuery.searchPrecision != val {
return fmt.Errorf("only one expression is allowed for %s", SearchPrecision)
}
switch val {
case PrecisionDay:
case PrecisionHour:
case PrecisionMinute:
case PrecisionSecond:
default:
return fmt.Errorf("invalid value for %s: %s", SearchPrecision, val)
}
parsedQuery.searchPrecision = new(val)
default:
return fmt.Errorf("unknown filter name: %s", colNameStr)
}
return nil
}
View on GitHub (pinned to bde624efd1)
Solutions
- Use the exact capitalized constants: Day, Hour, Minute, Second
- Normalize/validate user input to one of the four constants before building the query
- Reference the exported constants (s3store.PrecisionDay etc.) instead of string literals in Go code
Example fix
// before
`SearchPrecision = "day"`
// after
`SearchPrecision = "Day"` // or fmt.Sprintf("SearchPrecision = %q", s3store.PrecisionDay) Defensive patterns
Strategy: validation
Validate before calling
var validPrecisions = map[string]bool{"Day": true, "Hour": true, "Minute": true, "Second": true}
func validatePrecision(q string) error {
for _, p := range []string{"Day", "Hour", "Minute", "Second"} {
if strings.Contains(q, "SearchPrecision = \""+p+"\"") { return nil }
}
return fmt.Errorf("SearchPrecision must be Day, Hour, Minute, or Second")
} Type guard
func isValidPrecision(s string) bool {
switch s {
case "Day", "Hour", "Minute", "Second":
return true
}
return false
} Try / catch
parsed, err := parser.Parse(q)
if err != nil {
if strings.Contains(err.Error(), "invalid value for SearchPrecision") {
return nil, fmt.Errorf("use one of Day, Hour, Minute, Second (case-sensitive): %w", err)
}
return err
} Prevention
- Use the exported constants PrecisionDay/PrecisionHour/PrecisionMinute/PrecisionSecond
- Normalize user input case before building the query
- Unit-test generated query strings against the parser
When it happens
Trigger: Parsing `SearchPrecision = "day"` (lowercase), `SearchPrecision = "Daily"`, or any misspelled precision value.
Common situations: Case-sensitivity mistakes; UI passing user-friendly labels like 'per hour'; localization or capitalization drift between services composing the query.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- only operation = is support for %s
- can not query %s multiple times
- only one expression is allowed for %s
- unknown filter name: %s
- unknown workflow close status: %s
AI-assisted analysis of temporalio/temporal@bde624efd1 (2026-09-01).
Data as JSON: /api/errors/5c86d69b322107c3.
Report an issue: GitHub.