GoogleContainerTools/jib · error · JibPluginExtensionException

extension crashed: ${ex.getMessage()}

Error message

extension crashed: ${ex.getMessage()}

What it means

runPluginExtension catches any RuntimeException thrown while invoking the extension's extend() method and rethrows it as JibPluginExtensionException with 'extension crashed: <message>'. This marks the failure as originating inside the extension implementation rather than in Jib core or the user's build script.

Source

Thrown at jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/GradleProjectProperties.java:526

      } else {
        // configs.get() is of type Action, so this cast always succeeds.
        // (Note generic <T> is erased at runtime.)
        Action<T> action = (Action<T>) configs.get();
        extraConfig = project.getObjects().newInstance(extraConfigType.get(), project);
        action.execute(extraConfig);
      }
    }

    try {
      return ((JibGradlePluginExtension<T>) extension)
          .extendContainerBuildPlan(
              buildPlan,
              config.getProperties(),
              Optional.ofNullable(extraConfig),
              () -> project,
              new PluginExtensionLogger(this::log));
    } catch (RuntimeException ex) {
      throw new JibPluginExtensionException(
          extension.getClass(), "extension crashed: " + ex.getMessage(), ex);
    }
  }

  private JibGradlePluginExtension<?> findConfiguredExtension(
      List<JibGradlePluginExtension<?>> extensions, ExtensionConfiguration config)
      throws JibPluginExtensionException {
    Predicate<JibGradlePluginExtension<?>> matchesClassName =
        extension -> extension.getClass().getName().equals(config.getExtensionClass());
    Optional<JibGradlePluginExtension<?>> found =
        extensions.stream().filter(matchesClassName).findFirst();
    if (!found.isPresent()) {
      throw new JibPluginExtensionException(
          NullExtension.class,
          "extension configured but not discovered on Jib runtime classpath: "
              + config.getExtensionClass());
    }
    return found.get();

View on GitHub (pinned to fb949e2676)

Solutions

  1. Inspect the 'Caused by' chain for the original RuntimeException and fix the root cause in the project or extension inputs
  2. Remove or disable the pluginExtension to confirm the crash is extension-specific
  3. Upgrade or pin the extension and jib-gradle-plugin to mutually compatible versions; report the bug to the extension maintainer if reproducible

Example fix

// before: extension invoked on a project without bootJar
group 'com.example' // plain java-library project with spring-boot extension configured
// after: either apply the Spring Boot plugin so bootJar exists, or remove the pluginExtension block
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify extension prerequisites: e.g. for jib-spring-boot
assert project.plugins.hasPlugin('org.springframework.boot') : 'spring-boot extension requires the Spring Boot plugin'

Try / catch

try {
  tasks.named('jibBuildTar')
} catch (GradleException e) {
  if (e.message?.startsWith('extension crashed')) {
    logger.error('Extension threw: ' + e.cause?.message)
    // rerun without the extension or fix prerequisites
  } else throw e
}

Prevention

When it happens

Trigger: The extension's extend() throws at runtime - e.g. NullPointerException on missing project properties, ClassCastException on unexpected project layout, or IllegalStateException because prerequisite tasks/artifacts are absent.

Common situations: jib-spring-boot run on a non-Boot or non-Jar project; third-party extension incompatible with the current Jib API or Gradle version; extension assumes environment variables or files that do not exist in CI.

Related errors


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