{"record":{"id":"8c0a28fe03739e61","repo":"provectus/kafka-ui","slug":"filepath-can-t-be-set-for-built-in-serde-type","errorCode":null,"errorMessage":"filePath can't be set for built-in serde type","messagePattern":"filePath can't be set for built-in serde type","errorType":"validation","errorClass":"ValidationException","httpStatus":null,"severity":"error","filePath":"kafka-ui-api/src/main/java/com/provectus/kafka/ui/serdes/SerdesInitializer.java","lineNumber":236,"sourceCode":"    );\n  }\n\n  private boolean autoConfigureSerde(BuiltInSerde serde, PropertyResolver clusterProps, PropertyResolver globalProps) {\n    if (serde.canBeAutoConfigured(clusterProps, globalProps)) {\n      serde.autoConfigure(clusterProps, globalProps);\n      return true;\n    }\n    return false;\n  }\n\n  @SneakyThrows\n  private SerdeInstance createSerdeWithBuiltInClass(Class<? extends BuiltInSerde> clazz,\n                                                    SerdeConfig serdeConfig,\n                                                    PropertyResolver serdeProps,\n                                                    PropertyResolver clusterProps,\n                                                    PropertyResolver globalProps) {\n    if (serdeConfig.getFilePath() != null) {\n      throw new ValidationException(\"filePath can't be set for built-in serde type\");\n    }\n    BuiltInSerde serde = createSerdeInstance(clazz);\n    serde.configure(serdeProps, clusterProps, globalProps);\n    return new SerdeInstance(\n        serdeConfig.getName(),\n        serde,\n        nullablePattern(serdeConfig.getTopicKeysPattern()),\n        nullablePattern(serdeConfig.getTopicValuesPattern()),\n        null\n    );\n  }\n\n  @SneakyThrows\n  private <T extends Serde> T createSerdeInstance(Class<T> clazz) {\n    return clazz.getDeclaredConstructor().newInstance();\n  }\n\n  private SerdeInstance loadAndInitCustomSerde(SerdeConfig serdeConfig,","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/provectus/kafka-ui/blob/83b5a60cc08501b570a0c4d0b4cdfceb1b88d6b7/kafka-ui-api/src/main/java/com/provectus/kafka/ui/serdes/SerdesInitializer.java#L218-L254","documentation":"When a serde is configured by explicitly naming the built-in class (createSerdeWithBuiltInClass), the class comes from the application classpath, so an external filePath is not applicable; setting it throws ValidationException('filePath can't be set for built-in serde type').","triggerScenarios":"Configuring a serde via the built-in-class route (className referencing a BuiltInSerde class) while also setting filePath.","commonSituations":"Mixing custom-serde and built-in-serde config styles in one entry after refactoring configuration.","solutions":["Remove the filePath property from the entry","Keep only the built-in class designation plus any needed properties"],"exampleFix":"// before\nserde:\n  - name: my-protobuf\n    className: com.provectus.kafka.ui.serdes.builtin.ProtobufSerde\n    filePath: /opt/serdes/x.jar\n// after\nserde:\n  - name: my-protobuf\n    className: com.provectus.kafka.ui.serdes.builtin.ProtobufSerde","handlingStrategy":"validation","validationCode":"if (isBuiltInClass(cfg.getClassName()) && cfg.getFilePath() != null)\n  throw new IllegalArgumentException(\"filePath not allowed with built-in serde class\");","typeGuard":null,"tryCatchPattern":"try {\n  serde = createSerdeFromConfig(cfg, ...);\n} catch (ValidationException e) {\n  log.error(\"Bad serde config for {}: {}\", cfg.getName(), e.getMessage());\n  throw e;\n}","preventionTips":["Don't mix custom and built-in serde config styles in one entry","Remove filePath when className resolves to a BuiltInSerde","Review serde config after refactoring between styles"],"tags":["serde","config","validation","built-in"],"backgroundTag":"mutually-exclusive-options","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"}