GoogleContainerTools/jib · error · JibPluginExtensionException

extension configured but not discovered on Jib runtime class

Error message

extension configured but not discovered on Jib runtime classpath: ${config.getExtensionClass()}

What it means

Jib throws JibPluginExtensionException when a plugin extension configured via the `jib.extensions` block (with a fully-qualified class name) cannot be found among the JibGradlePluginExtension implementations available on Jib's runtime classpath. This means the configuration references an extension class that was never loaded/resolved, typically because the extension artifact is not a dependency of the build or the class name is misspelled.

Source

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

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

  private SourceSet getMainSourceSet() {
    SourceSetContainer sourceSetContainer =
        project.getExtensions().getByType(SourceSetContainer.class);
    return sourceSetContainer.getByName(MAIN_SOURCE_SET_NAME);
  }
}

View on GitHub (pinned to fb949e2676)

Solutions

  1. Add the Jib extension artifact (e.g. buildJibConfiguration / buildscript dependency) so its class is on the Jib plugin's runtime classpath
  2. Verify the configured class name exactly matches the extension class's getName(), including package
  3. Confirm the extension class implements JibGradlePluginExtension and is loadable (not shaded/renamed in a newer version)
  4. Temporarily list discovered extensions (or debug the classpath) to see which extensions Jib actually found

Example fix

// before
jib.extensions {
  myext {
    implementation = 'com.example.JibMyExt'   // not on classpath
  }
}
// after
dependencies {
  jibExt 'com.example:jib-my-extension:1.0.0' // or buildscript classpath dep
}
jib.extensions {
  myext {
    implementation = 'com.example.jib.JibMyExt' // exact FQCN, now discoverable
  }
}
Defensive patterns

Strategy: validation

Validate before calling

def expected = 'com.example.JibMyExt'
def discovered = project.extensions.findByType(JibExtension)?.extensions
if (discovered?.configuration?.implementation != expected) {
  throw new IllegalStateException("Extension ${expected} not configured or not on classpath")
}

Try / catch

try {
  jibTask.exec()
} catch (JibPluginExtensionException e) {
  if (e.message.contains('not discovered on Jib runtime classpath')) {
    logger.error('Add the extension artifact to the build classpath and verify the FQCN: ' + e.message)
  } else { throw e }
}

Prevention

When it happens

Trigger: Running a Jib task with `jib.extensions.<name>.implementation = 'com.example.SomeExtension'` (or the plugins-style extension config) where no class with that exact FQCN implementing JibGradlePluginExtension exists on the Jib runtime classpath; findConfiguredExtension streams the discovered extensions, filters by class name equality, and throws when findFirst() is empty.

Common situations: Adding an extension config entry without adding the extension JAR/dependency to the buildscript classpath; typo in the fully-qualified class name; the extension artifact version was changed and the class was renamed/moved; using a Maven extension class name in the Gradle build.

Related errors


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