temporalio/temporal · error

invalid value for %s: %s

Error message

invalid value for %s: %s

What it means

SearchPrecision must be one of the fixed values day, hour, minute, or second. Any other string value makes convertComparisonExpr return this error. The value controls time-bucket granularity used to locate the archived record.

Source

Thrown at common/archiver/gcloud/query_parser.go:195

		parsedQuery.workflowType = new(val)
	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

  1. Use exactly one of: day, hour, minute, second (lowercase)
  2. Check spelling and case of the precision value
  3. Omit SearchPrecision entirely if the caller does not control bucketing
  4. Cross-check against the Precision* constants in the gcloud archiver package

Example fix

// before
query := `WHERE StartTime = "..." AND SearchPrecision = "Day"`
// after
query := `WHERE StartTime = "..." AND SearchPrecision = "day"`
Defensive patterns

Strategy: validation

Validate before calling

var validPrecision = map[string]bool{"day":true,"hour":true,"minute":true,"second":true}
func precisionOK(v string) bool { return validPrecision[v] }

Try / catch

if !precisionOK(p) {
	return fmt.Errorf("SearchPrecision must be day|hour|minute|second, got %q", p)
}

Prevention

When it happens

Trigger: An archive query with e.g. `SearchPrecision = "Day"` (wrong case), `SearchPrecision = "weekly"`, or a misspelled precision value.

Common situations: Case-sensitivity mistakes (Day vs day); invented precision names; values localized or formatted differently than the expected lowercase constants.

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


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