{"record":{"id":"1c6541e46a31e062","repo":"temporalio/temporal","slug":"invalid-filter-name-s","errorCode":null,"errorMessage":"invalid filter name: %s","messagePattern":"invalid filter name: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/archiver/gcloud/query_parser.go","lineNumber":109,"sourceCode":"\t\treturn errors.New(\"only comparison and \\\"and\\\" expression is supported\")\n\t}\n}\n\nfunc (p *queryParser) convertParenExpr(parenExpr *sqlparser.ParenExpr, parsedQuery *parsedQuery) error {\n\treturn p.convertWhereExpr(parenExpr.Expr, parsedQuery)\n}\n\nfunc (p *queryParser) convertAndExpr(andExpr *sqlparser.AndExpr, parsedQuery *parsedQuery) error {\n\tif err := p.convertWhereExpr(andExpr.Left, parsedQuery); err != nil {\n\t\treturn err\n\t}\n\treturn p.convertWhereExpr(andExpr.Right, parsedQuery)\n}\n\nfunc (p *queryParser) convertComparisonExpr(compExpr *sqlparser.ComparisonExpr, parsedQuery *parsedQuery) error {\n\tcolName, ok := compExpr.Left.(*sqlparser.ColName)\n\tif !ok {\n\t\treturn fmt.Errorf(\"invalid filter name: %s\", sqlparser.String(compExpr.Left))\n\t}\n\tcolNameStr := sqlparser.String(colName)\n\top := compExpr.Operator\n\tvalExpr, ok := compExpr.Right.(*sqlparser.SQLVal)\n\tif !ok {\n\t\treturn fmt.Errorf(\"invalid value: %s\", sqlparser.String(compExpr.Right))\n\t}\n\tvalStr := sqlparser.String(valExpr)\n\n\tswitch colNameStr {\n\tcase WorkflowID:\n\t\tval, err := sqlquery.ExtractStringValue(valStr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif op != \"=\" {\n\t\t\treturn fmt.Errorf(\"only operation = is support for %s\", WorkflowID)\n\t\t}","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/common/archiver/gcloud/query_parser.go#L91-L127","documentation":"convertComparisonExpr in the gcloud archiver query parser requires the left side of every comparison to be a sqlparser.ColName (a recognized filter column like WorkflowId or CloseTime). If the left operand is not a column (e.g. a literal, function call, or arithmetic expression), it returns 'invalid filter name: %s' with the SQL-rendered operand.","triggerScenarios":"Issuing an archive search query whose WHERE clause compares something other than a plain column on the left, e.g. `WHERE 'wf-id' = WorkflowId`, `WHERE UPPER(WorkflowId) = 'x'`, or `WHERE CloseTime + 1 > 100`.","commonSituations":"Users copying standard-SQL queries into the archiver search box; expressions and functions are not supported — only simple column-op-value comparisons on known filter keys.","solutions":["Rewrite the comparison so a supported column (WorkflowId, RunId, CloseTime, etc.) is on the left side","Remove function calls or arithmetic from the WHERE clause — only literal column comparisons are supported","Use the supported operators (= for IDs, range operators for CloseTime) as documented"],"exampleFix":"// before\nWHERE UPPER(WorkflowId) = 'mywf'\n// after\nWHERE WorkflowId = 'mywf'","handlingStrategy":"validation","validationCode":"// Keep only simple col-op-value comparisons on the left:\n// valid:   WorkflowId = 'x'\n// invalid: UPPER(WorkflowId) = 'x'  /  'x' = WorkflowId\nif strings.ContainsAny(query, \"()+\") { // heuristic: expressions unsupported\n  return errors.New(\"archive query must compare a plain column to a literal\")\n}","typeGuard":"func isSimpleColumnComparison(where string) bool {\n  return !strings.Contains(where, \"(\") && knownColumns[leftToken(where)]\n}","tryCatchPattern":"_, err := client.ArchiveQuery(ctx, req)\nif err != nil && strings.Contains(err.Error(), \"invalid filter name\") {\n  return fmt.Errorf(\"unsupported WHERE expression in %q: %w\", req.Query, err)\n}","preventionTips":["Put the filter column first, unmodified by functions or arithmetic","Restrict query builders to the documented filter keys","Validate queries against the archiver grammar before submitting"],"tags":["go","archiver","gcloud","query-parser"],"backgroundTag":"invalid-query-filter-value","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}