{"record":{"id":"86ebccfe89369796","repo":"provectus/kafka-ui","slug":"classname-can-t-be-set-for-built-in-serde","errorCode":null,"errorMessage":"className can't be set for built-in serde","messagePattern":"className can't be set for built-in serde","errorType":"validation","errorClass":"ValidationException","httpStatus":null,"severity":"error","filePath":"kafka-ui-api/src/main/java/com/provectus/kafka/ui/serdes/SerdesInitializer.java","lineNumber":196,"sourceCode":"      var builtInSerdeClass = builtInSerdeClasses.values().stream()\n          .filter(c -> c.getName().equals(serdeConfig.getClassName()))\n          .findAny();\n      // built-in serde type with custom name\n      if (builtInSerdeClass.isPresent()) {\n        return createSerdeWithBuiltInClass(builtInSerdeClass.get(), serdeConfig, serdeProps, clusterProps, globalProps);\n      }\n    }\n    log.info(\"Loading custom serde {}\", serdeConfig.getName());\n    return loadAndInitCustomSerde(serdeConfig, serdeProps, clusterProps, globalProps);\n  }\n\n  private SerdeInstance createSerdeWithBuiltInSerdeName(SerdeConfig serdeConfig,\n                                                        PropertyResolver serdeProps,\n                                                        PropertyResolver clusterProps,\n                                                        PropertyResolver globalProps) {\n    String name = serdeConfig.getName();\n    if (serdeConfig.getClassName() != null) {\n      throw new ValidationException(\"className can't be set for built-in serde\");\n    }\n    if (serdeConfig.getFilePath() != null) {\n      throw new ValidationException(\"filePath can't be set for built-in serde types\");\n    }\n    var clazz = builtInSerdeClasses.get(name);\n    BuiltInSerde serde = createSerdeInstance(clazz);\n    if (serdeConfig.getProperties() == null || serdeConfig.getProperties().isEmpty()) {\n      if (!autoConfigureSerde(serde, clusterProps, globalProps)) {\n        // no properties provided and serde does not support auto-configuration\n        throw new ValidationException(name + \" serde is not configured\");\n      }\n    } else {\n      // configuring serde with explicitly set properties\n      serde.configure(serdeProps, clusterProps, globalProps);\n    }\n    return new SerdeInstance(\n        name,\n        serde,","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/provectus/kafka-ui/blob/83b5a60cc08501b570a0c4d0b4cdfceb1b88d6b7/kafka-ui-api/src/main/java/com/provectus/kafka/ui/serdes/SerdesInitializer.java#L178-L214","documentation":"Serde names that match built-in serde types (e.g. protobuf, avro-schema-registry) are instantiated from internal classes; supplying a className would conflict with the built-in class resolution, so createSerdeWithBuiltInSerdeName throws ValidationException.","triggerScenarios":"Using a built-in serde name in config while also setting className on the same serde entry.","commonSituations":"User copies a custom-serde config template and edits only filePath, leaving className set while keeping a built-in name like 'protobuf'.","solutions":["Remove the className field from the entry using the built-in serde name","Or rename the serde to a non-built-in name if you actually want a custom class"],"exampleFix":"// before\nserde:\n  - name: protobuf\n    className: com.provectus.kafka.ui.serdes.builtin.ProtobufSerde\n// after\nserde:\n  - name: protobuf","handlingStrategy":"validation","validationCode":"if (isBuiltInSerdeName(cfg.getName()) && cfg.getClassName() != null)\n  throw new IllegalArgumentException(\"className not allowed for built-in serde \" + cfg.getName());","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":["Use the minimal config template for built-in serdes (name + optional properties)","Only set className for genuinely custom serdes","Document which names are reserved built-in serde names"],"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"}