{"record":{"id":"41c8c00901de09ea","repo":"GoogleContainerTools/jib","slug":"extension-specific-configuration-for-extension","errorCode":null,"errorMessage":"extension-specific <configuration> for ${extension.getClass().getSimpleName()} is not of type ${extraConfigType.get().getName()} but ${configs.get().getClass().getName()}; specify the correct type with <pluginExtension><configuration implementation=\"${extraConfigType.get().getName()}\">","messagePattern":"extension-specific <configuration> for (.+?) is not of type (.+?) but (.+?); specify the correct type with <pluginExtension><configuration implementation=\"(.+?)\">","errorType":"validation","errorClass":"JibPluginExtensionException","httpStatus":null,"severity":"error","filePath":"jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/MavenProjectProperties.java","lineNumber":658,"sourceCode":"  // config type (as requested by \"JibMavenPluginExtension.getExtraConfigType()\").\n  @SuppressWarnings({\"unchecked\"})\n  private <T> ContainerBuildPlan runPluginExtension(\n      Optional<Class<T>> extraConfigType,\n      JibMavenPluginExtension<?> extension,\n      ExtensionConfiguration config,\n      ContainerBuildPlan buildPlan)\n      throws JibPluginExtensionException {\n    Optional<T> extraConfig = Optional.empty();\n    Optional<Object> configs = config.getExtraConfiguration();\n    if (configs.isPresent()) {\n      if (!extraConfigType.isPresent()) {\n        throw new IllegalArgumentException(\n            \"extension \"\n                + extension.getClass().getSimpleName()\n                + \" does not expect extension-specific configuration; remove the inapplicable \"\n                + \"<pluginExtension><configuration> from pom.xml\");\n      } else if (!extraConfigType.get().isInstance(configs.get())) {\n        throw new JibPluginExtensionException(\n            extension.getClass(),\n            \"extension-specific <configuration> for \"\n                + extension.getClass().getSimpleName()\n                + \" is not of type \"\n                + extraConfigType.get().getName()\n                + \" but \"\n                + configs.get().getClass().getName()\n                + \"; specify the correct type with <pluginExtension><configuration \"\n                + \"implementation=\\\"\"\n                + extraConfigType.get().getName()\n                + \"\\\">\");\n      } else {\n        // configs is of type Optional, so this cast always succeeds\n        // without the isInstance() check above. (Note generic <T> is erased at runtime.)\n        extraConfig = (Optional<T>) configs;\n      }\n    }\n","sourceCodeStart":640,"sourceCodeEnd":676,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/MavenProjectProperties.java#L640-L676","documentation":"The <pluginExtension><configuration> supplied in pom.xml was deserialized to a type that the extension does not accept. MavenProjectProperties.runPluginExtension checks extraConfigType.get().isInstance(configs.get()) and throws JibPluginExtensionException naming both the expected and actual class names.","triggerScenarios":"Specifying <configuration implementation=\"com.wrong.Type\"> where the implementation class does not match the type returned by the extension's getExtraConfigType(); Maven binding the extra configuration element to a generic/default type instead of the extension's expected class.","commonSituations":"Copy-pasting configuration implementation class names between extensions; typos in fully-qualified class names; upgrading an extension whose config class was renamed or repackaged while pom.xml still references the old name.","solutions":["Set the <configuration implementation=\"...\"> attribute to the exact class returned by the extension's getExtraConfigType() (check the extension's docs/source).","Search the extension's JAR/docs for its configuration class and copy its fully-qualified name verbatim.","Update pom.xml after extension upgrades if the configuration class package/name changed.","Temporarily remove the configuration to confirm the extension runs, then re-add with the correct implementation type."],"exampleFix":"<!-- before -->\n<configuration implementation=\"com.example.OldConfig\">\n  <foo>bar</foo>\n</configuration>\n\n<!-- after (matching extension's getExtraConfigType) -->\n<configuration implementation=\"com.google.cloud.tools.jib.maven.extension.JibSlf4jLoggerConfig\">\n  <!-- ... -->\n</configuration>","handlingStrategy":"validation","validationCode":"// Confirm the implementation class matches the extension's expected type\nClass<?> extConfigType = myExtension.getExtraConfigType().orElseThrow();\n// In pom.xml, configuration implementation must equal extConfigType.getName()","typeGuard":"boolean matchesExtensionConfigType(Object config, JibMavenPluginExtension<?> ext) {\n  return ext.getExtraConfigType().map(t -> t.isInstance(config)).orElse(false);\n}","tryCatchPattern":"try {\n  // mvn jib:build with extensions\n} catch (JibPluginExtensionException e) {\n  if (e.getMessage().contains(\"is not of type\")) {\n    // parse expected vs actual class names from the message and fix <configuration implementation=\"...\">\n  }\n  throw e;\n}","preventionTips":["Copy the implementation class name exactly from the extension's getExtraConfigType()/docs.","Re-check <configuration implementation> after any extension version upgrade.","Prefer using the extension's documented configuration snippet verbatim rather than adapting from other extensions."],"tags":["jib","maven","type-mismatch","plugin-extension","pom-configuration"],"backgroundTag":"config-type-mismatch","analyzedSha":"fb949e2676afbbd7dd7a1ef61e20251931325654","analyzedAt":"2026-09-06T14:04:09.491Z","contentChangedAt":"2026-09-06T14:04:09.491Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}