{"record":{"id":"c3f1920c783690c3","repo":"SigNoz/signoz","slug":"could-not-parse-expr-w","errorCode":null,"errorMessage":"could not parse expr: %w","messagePattern":"could not parse expr: %w","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/query-service/app/logparsingpipeline/pipelineBuilder.go","lineNumber":545,"sourceCode":"\t\tmemberRef := n.String()\n\n\t\t// coalesce ops end up as MemberNode right now for some reason.\n\t\t// ignore such member nodes.\n\t\tif strings.Contains(memberRef, \"??\") {\n\t\t\treturn\n\t\t}\n\n\t\tif strings.HasPrefix(memberRef, \"attributes\") || strings.HasPrefix(memberRef, \"resource\") {\n\t\t\tv.referencedFields = append(v.referencedFields, memberRef)\n\t\t}\n\t}\n}\n\nfunc logFieldsReferencedInExpr(expr string) ([]string, error) {\n\t// parse abstract syntax tree for expr\n\texprAst, err := parser.Parse(expr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not parse expr: %w\", err)\n\t}\n\n\t// walk ast for expr to collect all member references.\n\tv := &logFieldsInExprExtractor{}\n\tast.Walk(&exprAst.Node, v)\n\n\treturn v.referencedFields, nil\n}\n","sourceCodeStart":527,"sourceCodeEnd":554,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/app/logparsingpipeline/pipelineBuilder.go#L527-L554","documentation":"This is the lowest-level parse failure in the chain: parser.Parse (the expr-lang parser) could not build an AST for the given expression string. It is wrapped by logFieldsReferencedInExpr and surfaces up through fieldsReferencedInExprNotNilCheck and getOperators, so any operator whose `expr` fails to parse rejects the whole pipeline.","triggerScenarios":"Calling pipeline creation with an operator whose expr string is syntactically invalid: unbalanced parentheses, dangling operators, invalid tokens like \"attributes.a ++ attributes.b\", or an empty/whitespace-only expr.","commonSituations":"Typos in hand-authored pipeline JSON/YAML; expressions built via string concatenation that drop operands; using database-specific syntax (CAST, ::type) unsupported by expr-lang; version upgrades that changed the grammar.","solutions":["Validate/parse the expr string with github.com/expr-lang/expr before submitting the pipeline","Fix syntax errors (parens, operators, quoting)","Keep expressions to arithmetic, comparison, and the documented function set"],"exampleFix":"// before\nexpr: \"attributes.a ++ attributes.b\"\n// after\nexpr: \"attributes.a + attributes.b\"","handlingStrategy":"validation","validationCode":"import \"github.com/expr-lang/expr\"\nfunc checkExpr(s string) error {\n  if _, err := expr.Compile(s); err != nil { return fmt.Errorf(\"expr does not compile: %w\", err) }\n  return nil\n}","typeGuard":"func exprParses(s string) bool { _, err := parser.Parse(s); return err == nil }","tryCatchPattern":"Catch the API error, extract the inner parser message, and show it next to the expression field for correction (no retry — deterministic failure).","preventionTips":["Compile-check all expressions before submit","Avoid string concatenation to build exprs; use templates tested once","Pin expr-lang version matching query-service"],"tags":["signoz","expr-lang","expression-parsing","log-parsingpipeline"],"backgroundTag":"expression-parse-error","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}