{"record":{"id":"1886537e9051edd7","repo":"grpc/grpc-java","slug":"invalid-celmatcher-config","errorCode":null,"errorMessage":"Invalid CelMatcher config","messagePattern":"Invalid CelMatcher config","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"xds/src/main/java/io/grpc/xds/internal/matcher/CelStateMatcher.java","lineNumber":70,"sourceCode":"    public CelStateMatcher getMatcher(TypedExtensionConfig config) {\n      try {\n        com.github.xds.type.matcher.v3.CelMatcher celProto = config.getTypedConfig()\n            .unpack(com.github.xds.type.matcher.v3.CelMatcher.class);\n        if (!celProto.hasExprMatch()) {\n          throw new IllegalArgumentException(\"CelMatcher must have expr_match\");\n        }\n        CelExpression expr = celProto.getExprMatch();\n        if (!expr.hasCelExprChecked()) {\n          throw new IllegalArgumentException(\"CelMatcher must have cel_expr_checked\");\n        }\n        CelAbstractSyntaxTree ast = \n            CelProtoAbstractSyntaxTree.fromCheckedExpr(\n                expr.getCelExprChecked()).getAst();\n        CelMatcher compiled = CelMatcher.compile(ast);\n        \n        return new CelStateMatcher(compiled);\n      } catch (Exception e) {\n        throw new IllegalArgumentException(\"Invalid CelMatcher config\", e);\n      }\n    }\n\n    @Override\n    public String typeUrl() {\n      return TYPE_URL;\n    }\n  }\n}\n","sourceCodeStart":52,"sourceCodeEnd":80,"githubUrl":"https://github.com/grpc/grpc-java/blob/64daddc1f3d1975670f769f3e97bde8b2ba32d25/xds/src/main/java/io/grpc/xds/internal/matcher/CelStateMatcher.java#L52-L80","documentation":"getMatcher() wraps the whole unpack/validate/compile sequence in a catch-all that rethrows any failure as IllegalArgumentException(\"Invalid CelMatcher config\", e). This is a generic factory-level wrapper: the original cause (unpack failure, missing fields, CEL type errors) is preserved as the cause chain. Any malformed CelMatcher typed_config ends up here.","triggerScenarios":"Any exception during getMatcher(): typed_config cannot be unpacked to the CelMatcher proto type, expr_match or cel_expr_checked missing, or CelMatcher.compile() rejecting a non-BOOL AST.","commonSituations":"Wrong type_url / mismatched packed Any payload; older or newer proto schemas on control plane vs data plane; non-boolean CEL expressions; version skew where the client lacks a referenced xDS matcher type.","solutions":["Inspect the cause via e.getCause() to find the real problem (unpack error, missing field, or compile type error).","Verify the TypedExtensionConfig's typeUrl matches TYPE_URL and that the Any payload is a well-formed CelMatcher proto.","Confirm expr_match.cel_expr_checked is a BOOL-typed checked expression before sending the config.","Catch IllegalArgumentException around getMatcher() and NACK the config with the root cause logged."],"exampleFix":"// before\ntry { matcher = factory.getMatcher(config); } catch (Exception e) { e.printStackTrace(); }\n// after\ntry { matcher = factory.getMatcher(config); }\ncatch (IllegalArgumentException e) {\n  logger.log(WARNING, \"Bad CelMatcher config\", e.getCause()); // inspect cause\n  nackConfig(config, e.getMessage());\n}","handlingStrategy":"try-catch","validationCode":"if (!TYPE_URL.equals(config.getTypedConfig().getTypeUrl()))\n  throw new IllegalArgumentException(\"unexpected typeUrl: \" + config.getTypedConfig().getTypeUrl());","typeGuard":"boolean isCelMatcherConfig(TypedExtensionConfig c) { return TYPE_URL.equals(c.getTypedConfig().getTypeUrl()); }","tryCatchPattern":"try { return factory.getMatcher(config); }\ncatch (IllegalArgumentException e) {\n  logger.log(WARNING, \"Invalid CelMatcher config\", e.getCause());\n  nackConfig(config, e.getMessage());\n  return null;\n}","preventionTips":["Always inspect e.getCause() — the real failure is in the wrapped exception.","Validate type_url and payload shape before calling getMatcher().","NACK invalid xDS configs instead of crashing the request path.","Log the full proto for triage when this wrapper fires."],"tags":["grpc-xds","config-validation","wrapper-exception","cel"],"backgroundTag":"invalid-config-value","analyzedSha":"64daddc1f3d1975670f769f3e97bde8b2ba32d25","analyzedAt":"2026-09-08T06:14:57.704Z","contentChangedAt":"2026-09-08T06:14:57.704Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}