{"record":{"id":"5db63e73e5be5a1a","repo":"provectus/kafka-ui","slug":"groovy-filters-is-not-allowed-set-filtering-groov","errorCode":null,"errorMessage":"Groovy filters is not allowed. Set filtering.groovy.enabled property to 'true' to enabled it.","messagePattern":"Groovy filters is not allowed\\. Set filtering\\.groovy\\.enabled property to 'true' to enabled it\\.","errorType":"validation","errorClass":"ValidationException","httpStatus":400,"severity":"error","filePath":"kafka-ui-api/src/main/java/com/provectus/kafka/ui/util/DynamicConfigOperations.java","lineNumber":157,"sourceCode":"            new FileUploadException(\"Error creating directory for uploads %s\".formatted(targetDir), e));\n      }\n    }\n\n    Path targetFilePath = targetDir.resolve(file.filename() + \"-\" + Instant.now().getEpochSecond());\n    log.info(\"Uploading config-related file {}\", targetFilePath);\n    if (Files.exists(targetFilePath)) {\n      log.info(\"File {} already exists, it will be overwritten\", targetFilePath);\n    }\n\n    return file.transferTo(targetFilePath)\n        .thenReturn(targetFilePath)\n        .doOnError(th -> log.error(\"Error uploading file {}\", targetFilePath, th))\n        .onErrorMap(th -> new FileUploadException(targetFilePath, th));\n  }\n\n  public void checkIfFilteringGroovyEnabled() {\n    if (!filteringGroovyEnabled()) {\n      throw new ValidationException(\n              \"Groovy filters is not allowed. \"\n                      + \"Set filtering.groovy.enabled property to 'true' to enabled it.\");\n    }\n  }\n\n  private void checkIfDynamicConfigEnabled() {\n    if (!dynamicConfigEnabled()) {\n      throw new ValidationException(\n          \"Dynamic config change is not allowed. \"\n              + \"Set dynamic.config.enabled property to 'true' to enabled it.\");\n    }\n  }\n\n  @SneakyThrows\n  private void writeYamlToFile(String yaml, Path path) {\n    if (Files.isDirectory(path)) {\n      throw new ValidationException(\"Dynamic file path is a directory, but should be a file path\");\n    }","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/provectus/kafka-ui/blob/83b5a60cc08501b570a0c4d0b4cdfceb1b88d6b7/kafka-ui-api/src/main/java/com/provectus/kafka/ui/util/DynamicConfigOperations.java#L139-L175","documentation":"DynamicConfigOperations.checkIfFilteringGroovyEnabled() guards creation of message filters written in Groovy. Because Groovy filter scripts execute arbitrary code, kafka-ui only allows them when the `filtering.groovy.enabled=true` property is set; otherwise it throws this ValidationException when a Groovy filter is submitted.","triggerScenarios":"Creating or editing a messages filter in the UI choosing the Groovy engine while the app was started without `filtering.groovy.enabled: true` (or env var FILTERING_GROOVY_ENABLED=true).","commonSituations":"Kubernetes deployment where the property wasn't added to the chart values; security-conscious default left untouched; upgrading kafka-ui and reusing an old config that never enabled Groovy.","solutions":["Set `filtering.groovy.enabled: true` in the kafka-ui application config (or env var FILTERING_GROOVY_ENABLED=true) and restart","If Groovy isn't wanted, rewrite the filter using the CEL engine instead of Groovy","In Kubernetes, add the property to helm values under config and redeploy"],"exampleFix":"// before (application.yml)\nfiltering:\n  enabled: true\n// after\nfiltering:\n  enabled: true\n  groovy:\n    enabled: true","handlingStrategy":"validation","validationCode":"if (!filteringGroovyEnabled) {\n  throw new IllegalStateException(\"Enable filtering.groovy.enabled=true before using Groovy filters\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  filterService.register(groovyFilter);\n} catch (ValidationException e) {\n  if (e.getMessage().contains(\"Groovy\")) {\n    // fall back to CEL filter or surface setup instructions\n  }\n}","preventionTips":["Set filtering.groovy.enabled explicitly in deployment manifests if Groovy is required","Prefer CEL filters to avoid enabling Groovy","Document the flag next to the filter feature in your runbook"],"tags":["configuration","feature-flag","groovy"],"backgroundTag":"feature-not-enabled","analyzedSha":"83b5a60cc08501b570a0c4d0b4cdfceb1b88d6b7","analyzedAt":"2026-09-08T04:35:39.002Z","contentChangedAt":"2026-09-08T04:35:39.002Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}