{"record":{"id":"e5ff278e160cd42e","repo":"caddyserver/caddy","slug":"cel-request-matcher-expects-return-type-of-bool-n","errorCode":null,"errorMessage":"CEL request matcher expects return type of bool, not %s","messagePattern":"CEL request matcher expects return type of bool, not (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/caddyhttp/celmatcher.go","lineNumber":192,"sourceCode":"\t\text.Bindings(),\n\t\text.Lists(),\n\t\text.Math(),\n\t\tmatcherLib,\n\t)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"setting up CEL environment: %v\", err)\n\t}\n\n\t// parse and type-check the expression\n\tchecked, issues := env.Compile(m.expandedExpr)\n\tif issues.Err() != nil {\n\t\treturn fmt.Errorf(\"compiling CEL program: %s\", issues.Err())\n\t}\n\n\t// request matching is a boolean operation, so we don't really know\n\t// what to do if the expression returns a non-boolean type\n\tif checked.OutputType() != cel.BoolType {\n\t\treturn fmt.Errorf(\"CEL request matcher expects return type of bool, not %s\", checked.OutputType())\n\t}\n\n\t// compile the \"program\"\n\tm.prg, err = env.Program(checked, cel.EvalOptions(cel.OptOptimize))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"compiling CEL program: %s\", err)\n\t}\n\treturn nil\n}\n\n// Match returns true if r matches m.\nfunc (m MatchExpression) Match(r *http.Request) bool {\n\tmatch, err := m.MatchWithError(r)\n\tif err != nil {\n\t\tSetVar(r.Context(), MatcherErrorVarKey, err)\n\t}\n\treturn match\n}","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/modules/caddyhttp/celmatcher.go#L174-L210","documentation":"Error \"CEL request matcher expects return type of bool, not %s\" thrown in caddyserver/caddy.","triggerScenarios":"Thrown at modules/caddyhttp/celmatcher.go:192 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Change the CEL expression so it evaluates to a boolean, for example by adding a comparison."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"50e54ee279aa1e504fe218ca49ab6ae16c100410","analyzedAt":"2026-08-15T09:20:21.641Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}