{"record":{"id":"0ad23195b806f0cc","repo":"GoogleContainerTools/jib","slug":"extension-crashed-ex-getmessage","errorCode":null,"errorMessage":"extension crashed: ${ex.getMessage()}","messagePattern":"extension crashed: (.+?)","errorType":"exception","errorClass":"JibPluginExtensionException","httpStatus":null,"severity":"error","filePath":"jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/GradleProjectProperties.java","lineNumber":526,"sourceCode":"      } else {\n        // configs.get() is of type Action, so this cast always succeeds.\n        // (Note generic <T> is erased at runtime.)\n        Action<T> action = (Action<T>) configs.get();\n        extraConfig = project.getObjects().newInstance(extraConfigType.get(), project);\n        action.execute(extraConfig);\n      }\n    }\n\n    try {\n      return ((JibGradlePluginExtension<T>) extension)\n          .extendContainerBuildPlan(\n              buildPlan,\n              config.getProperties(),\n              Optional.ofNullable(extraConfig),\n              () -> project,\n              new PluginExtensionLogger(this::log));\n    } catch (RuntimeException ex) {\n      throw new JibPluginExtensionException(\n          extension.getClass(), \"extension crashed: \" + ex.getMessage(), ex);\n    }\n  }\n\n  private JibGradlePluginExtension<?> findConfiguredExtension(\n      List<JibGradlePluginExtension<?>> extensions, ExtensionConfiguration config)\n      throws JibPluginExtensionException {\n    Predicate<JibGradlePluginExtension<?>> matchesClassName =\n        extension -> extension.getClass().getName().equals(config.getExtensionClass());\n    Optional<JibGradlePluginExtension<?>> found =\n        extensions.stream().filter(matchesClassName).findFirst();\n    if (!found.isPresent()) {\n      throw new JibPluginExtensionException(\n          NullExtension.class,\n          \"extension configured but not discovered on Jib runtime classpath: \"\n              + config.getExtensionClass());\n    }\n    return found.get();","sourceCodeStart":508,"sourceCodeEnd":544,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/GradleProjectProperties.java#L508-L544","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the 'Caused by' chain for the original RuntimeException and fix the root cause in the project or extension inputs","Remove or disable the pluginExtension to confirm the crash is extension-specific","Upgrade or pin the extension and jib-gradle-plugin to mutually compatible versions; report the bug to the extension maintainer if reproducible"],"exampleFix":"// before: extension invoked on a project without bootJar\ngroup 'com.example' // plain java-library project with spring-boot extension configured\n// after: either apply the Spring Boot plugin so bootJar exists, or remove the pluginExtension block","handlingStrategy":"try-catch","validationCode":"// Verify extension prerequisites: e.g. for jib-spring-boot\nassert project.plugins.hasPlugin('org.springframework.boot') : 'spring-boot extension requires the Spring Boot plugin'","typeGuard":null,"tryCatchPattern":"try {\n  tasks.named('jibBuildTar')\n} catch (GradleException e) {\n  if (e.message?.startsWith('extension crashed')) {\n    logger.error('Extension threw: ' + e.cause?.message)\n    // rerun without the extension or fix prerequisites\n  } else throw e\n}","preventionTips":["Confirm project layout prerequisites (plugins, tasks, artifacts) before enabling an extension","Pin extension and Jib plugin versions that were released together","Read the full Caused-by chain - the RuntimeException inside carries the actionable message"],"tags":["jib","gradle","plugin-extension","runtime-exception"],"backgroundTag":"plugin-extension-crashed","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"}