GoogleContainerTools/jib · error · GradleException

Invalid containerizing mode

Error message

Invalid containerizing mode

What it means

ContainerizingMode.from(...) throws InvalidContainerizingModeException when the configured string is not a known mode; SyncMapTask converts that into a GradleException('Invalid containerizing mode', ex). It is a wrapper so the raw enum-parse failure surfaces as a build-script error.

Source

Thrown at jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/skaffold/SyncMapTask.java:80

      // TODO: move these shared checks with SyncMapMojo into plugins-common
      if (projectProperties.isWarProject()) {
        throw new GradleException(
            "Skaffold sync is currently only available for 'jar' style Jib projects, but the project "
                + getProject().getName()
                + " is configured to generate a 'war'");
      }
      try {
        if (!ContainerizingMode.EXPLODED.equals(
            ContainerizingMode.from(jibExtension.getContainerizingMode()))) {
          throw new GradleException(
              "Skaffold sync is currently only available for Jib projects in 'exploded' containerizing mode, but the containerizing mode of "
                  + getProject().getName()
                  + " is '"
                  + jibExtension.getContainerizingMode()
                  + "'");
        }
      } catch (InvalidContainerizingModeException ex) {
        throw new GradleException("Invalid containerizing mode", ex);
      }

      try {
        String syncMapJson =
            PluginConfigurationProcessor.getSkaffoldSyncMap(
                configuration,
                projectProperties,
                jibExtension.getSkaffold().getSync().getExcludes());

        System.out.println();
        System.out.println("BEGIN JIB JSON: SYNCMAP/1");
        System.out.println(syncMapJson);

      } catch (Exception ex) {
        throw new GradleException("Failed to generate a Jib file map for sync with Skaffold", ex);
      }
    }
  }

View on GitHub (pinned to fb949e2676)

Solutions

  1. Set containerizingMode to exactly 'exploded' or 'packaged' (lowercase, no whitespace).
  2. Check the cause exception in the Gradle output for the offending value.
  3. Validate any property-driven mode value before it reaches the jib extension.
  4. Upgrade the plugin if the mode string you used is from newer Jib docs than your plugin version.

Example fix

// before
jib { containerizingMode = 'Exploded' }
// after
jib { containerizingMode = 'exploded' }
Defensive patterns

Strategy: validation

Validate before calling

def mode = jib.containerizingMode.get()
assert mode in ['exploded', 'packaged'] : "Invalid containerizingMode: $mode"

Try / catch

try {
  jib.containerizingMode = providers.gradleProperty('jib.containerizingMode').orElse('exploded')
} catch (Exception ignored) { }

Prevention

When it happens

Trigger: Setting jib.containerizingMode (or containerizingMode property) to a misspelled or invalid string such as 'explode', 'Exploded', or 'packaged ' with stray whitespace, then running the Skaffold sync map task.

Common situations: Typos in build.gradle or in passed -P properties; case-sensitivity mistakes; values copied from Maven docs that don't match the Gradle extension's accepted strings.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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