provectus/kafka-ui · error · ValidationException

filePath can't be set for built-in serde type

Error message

filePath can't be set for built-in serde type

What it means

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').

Solutions

  1. Remove the filePath property from the entry
  2. Keep only the built-in class designation plus any needed properties

Example fix

// before
serde:
  - name: my-protobuf
    className: com.provectus.kafka.ui.serdes.builtin.ProtobufSerde
    filePath: /opt/serdes/x.jar
// after
serde:
  - name: my-protobuf
    className: com.provectus.kafka.ui.serdes.builtin.ProtobufSerde
Defensive patterns

Strategy: validation

Validate before calling

if (isBuiltInClass(cfg.getClassName()) && cfg.getFilePath() != null)
  throw new IllegalArgumentException("filePath not allowed with built-in serde class");

Try / catch

try {
  serde = createSerdeFromConfig(cfg, ...);
} catch (ValidationException e) {
  log.error("Bad serde config for {}: {}", cfg.getName(), e.getMessage());
  throw e;
}

Prevention

When it happens

Trigger: Configuring a serde via the built-in-class route (className referencing a BuiltInSerde class) while also setting filePath.

Common situations: Mixing custom-serde and built-in-serde config styles in one entry after refactoring configuration.

Related errors


AI-assisted analysis of provectus/kafka-ui@83b5a60cc0 (2026-09-08). Data as JSON: /api/errors/8c0a28fe03739e61. Report an issue: GitHub.

Appendix: source

Thrown at kafka-ui-api/src/main/java/com/provectus/kafka/ui/serdes/SerdesInitializer.java:236

    );
  }

  private boolean autoConfigureSerde(BuiltInSerde serde, PropertyResolver clusterProps, PropertyResolver globalProps) {
    if (serde.canBeAutoConfigured(clusterProps, globalProps)) {
      serde.autoConfigure(clusterProps, globalProps);
      return true;
    }
    return false;
  }

  @SneakyThrows
  private SerdeInstance createSerdeWithBuiltInClass(Class<? extends BuiltInSerde> clazz,
                                                    SerdeConfig serdeConfig,
                                                    PropertyResolver serdeProps,
                                                    PropertyResolver clusterProps,
                                                    PropertyResolver globalProps) {
    if (serdeConfig.getFilePath() != null) {
      throw new ValidationException("filePath can't be set for built-in serde type");
    }
    BuiltInSerde serde = createSerdeInstance(clazz);
    serde.configure(serdeProps, clusterProps, globalProps);
    return new SerdeInstance(
        serdeConfig.getName(),
        serde,
        nullablePattern(serdeConfig.getTopicKeysPattern()),
        nullablePattern(serdeConfig.getTopicValuesPattern()),
        null
    );
  }

  @SneakyThrows
  private <T extends Serde> T createSerdeInstance(Class<T> clazz) {
    return clazz.getDeclaredConstructor().newInstance();
  }

  private SerdeInstance loadAndInitCustomSerde(SerdeConfig serdeConfig,

View on GitHub (pinned to 83b5a60cc0)