temporalio/temporal · error

only one expression is allowed for %s

Error message

only one expression is allowed for %s

What it means

Returned by the S3 archival query parser when a query string for a Visibility SQL filter contains more than one expression for the given field (e.g. multiple comparisons on the same key). Only a single expression per field is supported.

Source

Thrown at common/archiver/s3store/query_parser.go:177

	case StartTime:
		timestamp, err := sqlquery.ConvertToTime(valStr)
		if err != nil {
			return err
		}
		if op != "=" {
			return fmt.Errorf("only operation = is support for %s", StartTime)
		}
		parsedQuery.startTime = &timestamp
	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. Emit exactly one SearchPrecision clause per query
  2. Deduplicate precision clauses in query-builder code, keeping the first value
  3. Remember a query may contain only one of StartTime or CloseTime anyway, so one precision suffices

Example fix

// before
`StartTime = "2023-01-01" AND SearchPrecision = "Day" AND SearchPrecision = "Hour"`
// after
`StartTime = "2023-01-01" AND SearchPrecision = "Day"`
Defensive patterns

Strategy: validation

Validate before calling

if strings.Count(q, "SearchPrecision") > 1 {
    return fmt.Errorf("query must contain at most one SearchPrecision filter")
}

Try / catch

parsed, err := parser.Parse(q)
if err != nil {
    if strings.Contains(err.Error(), "only one expression is allowed") {
        return nil, fmt.Errorf("conflicting SearchPrecision values: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: Parsing `SearchPrecision = "Day" AND SearchPrecision = "Hour"` — parsedQuery.searchPrecision is already set and differs from the new value, so the error is returned.

Common situations: Query builders emitting a precision clause for both StartTime and CloseTime; combining query fragments that each add their own precision; user confusion between AND semantics and single-value constraints.

Related errors


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