temporalio/temporal · error
where expression is nil
Error message
where expression is nil
What it means
Filestore variant of the nil WHERE expression error, thrown by filestore queryParser.convertWhereExpr (common/archiver/filestore/query_parser.go) when the parsed SELECT has no WHERE expression. It is reached from Parse, convertParenExpr, and convertAndExpr; the filestore visibility query parser only supports filtering queries with a WHERE clause.
Source
Thrown at common/archiver/filestore/query_parser.go:73
latestCloseTime: time.Now().UTC(),
}
if strings.TrimSpace(query) == "" {
return parsedQuery, nil
}
stmt, err := sqlparser.Parse(fmt.Sprintf(sqlquery.QueryTemplate, query))
if err != nil {
return nil, err
}
whereExpr := stmt.(*sqlparser.Select).Where.Expr
if err := p.convertWhereExpr(whereExpr, parsedQuery); err != nil {
return nil, err
}
return parsedQuery, nil
}
func (p *queryParser) convertWhereExpr(expr sqlparser.Expr, parsedQuery *parsedQuery) error {
if expr == nil {
return errors.New("where expression is nil")
}
switch expr := expr.(type) {
case *sqlparser.ComparisonExpr:
return p.convertComparisonExpr(expr, parsedQuery)
case *sqlparser.AndExpr:
return p.convertAndExpr(expr, parsedQuery)
case *sqlparser.ParenExpr:
return p.convertParenExpr(expr, parsedQuery)
default:
return errors.New("only comparison and \"and\" expression is supported")
}
}
func (p *queryParser) convertParenExpr(parenExpr *sqlparser.ParenExpr, parsedQuery *parsedQuery) error {
return p.convertWhereExpr(parenExpr.Expr, parsedQuery)
}
View on GitHub (pinned to bde624efd1)
Solutions
- Supply a valid WHERE clause with a WorkflowId or RunId equality condition (filestore queries key directly off these fields).
- Check for empty/whitespace query strings before calling Parse and return a clearer caller-side error.
- Use a direct GetHistory call (by namespace/run ID) instead of query parsing when you already know the run.
- Note: unlike the gcloud parser, filestore does not require StartTime/CloseTime/SearchPrecision.
Example fix
// before
parsed, err := filestore.NewQueryParser().Parse("") // error: where expression is nil
// after
parsed, err := filestore.NewQueryParser().Parse("WorkflowId = 'my-workflow'") Defensive patterns
Strategy: validation
Validate before calling
if strings.TrimSpace(query) == "" {
return nil, errors.New("filestore visibility query must contain a WHERE clause")
}
parsed, err := filestore.NewQueryParser().Parse(query) Prevention
- Guard against empty query strings before calling Parse.
- Prefer direct GetHistory-by-run-ID calls when identifiers are already known.
- Centralize filestore query construction in one helper that always injects a condition.
When it happens
Trigger: Calling filestore.NewQueryParser().Parse("") or any input that yields a SELECT with a nil WHERE expr (e.g. empty query string substituted into sqlquery.QueryTemplate), or recursion into a nil parenthesized/AND sub-expression.
Common situations: Empty --query passed to `temporal workflow list` when the namespace uses filestore archival visibility; dynamically built queries where the condition was dropped; path/URI-only lookups that should not go through the query parser at all.
Related errors
- SearchPrecision is required when searching for a StartTime o
- where expression is nil
- only comparison and "and" expression is supported
- only comparison and "and" expression is supported
- failed to parse visibility filename %s
AI-assisted analysis of temporalio/temporal@bde624efd1 (2026-09-01).
Data as JSON: /api/errors/3fb4c554365da8ff.
Report an issue: GitHub.