GoogleContainerTools/jib · error · JibPluginExtensionException

extension-specific <configuration> for ${extension.getClass(

Error message

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()}">

What it means

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.

Source

Thrown at jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/MavenProjectProperties.java:658

  // config type (as requested by "JibMavenPluginExtension.getExtraConfigType()").
  @SuppressWarnings({"unchecked"})
  private <T> ContainerBuildPlan runPluginExtension(
      Optional<Class<T>> extraConfigType,
      JibMavenPluginExtension<?> extension,
      ExtensionConfiguration config,
      ContainerBuildPlan buildPlan)
      throws JibPluginExtensionException {
    Optional<T> extraConfig = Optional.empty();
    Optional<Object> configs = config.getExtraConfiguration();
    if (configs.isPresent()) {
      if (!extraConfigType.isPresent()) {
        throw new IllegalArgumentException(
            "extension "
                + extension.getClass().getSimpleName()
                + " does not expect extension-specific configuration; remove the inapplicable "
                + "<pluginExtension><configuration> from pom.xml");
      } else if (!extraConfigType.get().isInstance(configs.get())) {
        throw new JibPluginExtensionException(
            extension.getClass(),
            "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()
                + "\">");
      } else {
        // configs is of type Optional, so this cast always succeeds
        // without the isInstance() check above. (Note generic <T> is erased at runtime.)
        extraConfig = (Optional<T>) configs;
      }
    }

View on GitHub (pinned to fb949e2676)

Solutions

  1. Set the <configuration implementation="..."> attribute to the exact class returned by the extension's getExtraConfigType() (check the extension's docs/source).
  2. Search the extension's JAR/docs for its configuration class and copy its fully-qualified name verbatim.
  3. Update pom.xml after extension upgrades if the configuration class package/name changed.
  4. Temporarily remove the configuration to confirm the extension runs, then re-add with the correct implementation type.

Example fix

<!-- before -->
<configuration implementation="com.example.OldConfig">
  <foo>bar</foo>
</configuration>

<!-- after (matching extension's getExtraConfigType) -->
<configuration implementation="com.google.cloud.tools.jib.maven.extension.JibSlf4jLoggerConfig">
  <!-- ... -->
</configuration>
Defensive patterns

Strategy: validation

Validate before calling

// Confirm the implementation class matches the extension's expected type
Class<?> extConfigType = myExtension.getExtraConfigType().orElseThrow();
// In pom.xml, configuration implementation must equal extConfigType.getName()

Type guard

boolean matchesExtensionConfigType(Object config, JibMavenPluginExtension<?> ext) {
  return ext.getExtraConfigType().map(t -> t.isInstance(config)).orElse(false);
}

Try / catch

try {
  // mvn jib:build with extensions
} catch (JibPluginExtensionException e) {
  if (e.getMessage().contains("is not of type")) {
    // parse expected vs actual class names from the message and fix <configuration implementation="...">
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of GoogleContainerTools/jib@fb949e2676 (2026-09-06). Data as JSON: /api/errors/41c8c00901de09ea. Report an issue: GitHub.