temporalio/temporal · error

only one expression is allowed for %s

Error message

only one expression is allowed for %s

What it means

The gcloud archive parser allows SearchPrecision to appear at most once. If it appears in two equality expressions with different values (e.g. `SearchPrecision = "day" AND SearchPrecision = "hour"`), convertComparisonExpr returns this error. Equal duplicate values are tolerated silently; only conflicting duplicates fail.

Source

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

		}
		if op != "=" {
			return fmt.Errorf("only operation = is support for %s", WorkflowType)
		}
		if parsedQuery.workflowType != nil && *parsedQuery.workflowType != val {
			parsedQuery.emptyResult = true
			return nil
		}
		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. Keep exactly one SearchPrecision clause with a single value
  2. Audit the query-construction code for duplicate filter injection
  3. Choose one precision level (day/hour/minute/second) appropriate for the query
  4. Pre-parse or normalize the query to de-duplicate SearchPrecision before calling the archive API

Example fix

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

Strategy: validation

Validate before calling

if strings.Count(q, "SearchPrecision") > 1 {
	return errors.New("at most one SearchPrecision clause allowed")
}

Try / catch

q, err := parseArchiveQuery(raw)
if err != nil {
	return fmt.Errorf("dedupe SearchPrecision clauses: %w", err)
}

Prevention

When it happens

Trigger: A WHERE clause containing two SearchPrecision predicates with different values; query builders concatenating filter fragments that each append their own SearchPrecision term.

Common situations: Programmatic query construction where the precision is injected by both a caller and a default-template layer; hand-edited queries accumulating duplicate clauses.

Related errors


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