GoogleContainerTools/jib · error · GradleException

invalid value for containerizingMode: ${invalidContainerizin

Error message

invalid value for containerizingMode: ${invalidContainerizingMode}

What it means

Jib validates containerizingMode against a fixed set of allowed values (exploded, packaged). An InvalidContainerizingModeException is thrown when jib.containerizingMode has any other value, and the Gradle task surfaces it as this error. The mode controls whether the app is copied as exploded directories or a packaged jar.

Source

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

                "'jib.to.image'",
                "build.gradle",
                "gradle jib --image <your image name>"));
      }

      PluginConfigurationProcessor.createJibBuildRunnerForRegistryImage(
              new GradleRawConfiguration(jibExtension),
              ignored -> Optional.empty(),
              projectProperties,
              globalConfig,
              new GradleHelpfulSuggestions(HELPFUL_SUGGESTIONS_PREFIX))
          .runBuild();

    } catch (InvalidAppRootException ex) {
      throw new GradleException(
          "container.appRoot is not an absolute Unix-style path: " + ex.getInvalidPathValue(), ex);

    } catch (InvalidContainerizingModeException ex) {
      throw new GradleException(
          "invalid value for containerizingMode: " + ex.getInvalidContainerizingMode(), ex);

    } catch (InvalidWorkingDirectoryException ex) {
      throw new GradleException(
          "container.workingDirectory is not an absolute Unix-style path: "
              + ex.getInvalidPathValue(),
          ex);
    } catch (InvalidPlatformException ex) {
      throw new GradleException(
          "from.platforms contains a platform configuration that is missing required values or has invalid values: "
              + ex.getMessage()
              + ": "
              + ex.getInvalidPlatform(),
          ex);

    } catch (InvalidContainerVolumeException ex) {
      throw new GradleException(
          "container.volumes is not an absolute Unix-style path: " + ex.getInvalidVolume(), ex);

View on GitHub (pinned to fb949e2676)

Solutions

  1. Set containerizingMode to exactly 'exploded' or 'packaged' (lowercase, no whitespace).
  2. Remove the containerizingMode setting to use the default ('exploded').
  3. Check the plugin version supports the chosen mode (packaged was added later; upgrade the plugin if needed).

Example fix

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

Strategy: validation

Validate before calling

def mode = jib.containerizingMode
if (mode != null && !(mode in ['exploded', 'packaged'])) {
  throw new GradleException("containerizingMode must be 'exploded' or 'packaged', got: $mode")
}

Try / catch

try {
  tasks.named('jib').get().execute()
} catch (GradleException e) {
  if (e.message?.startsWith('invalid value for containerizingMode')) {
    logger.error("Use 'exploded' or 'packaged': ${e.message}")
  }
  throw e
}

Prevention

When it happens

Trigger: Setting jib.containerizingMode to a misspelled or unsupported value (e.g. 'explode', ' Exploded', 'war') in build.gradle or via -Djib.containerizingMode=... before running a jib task.

Common situations: Typos when enabling the faster exploded mode; following an outdated blog post using a removed/renamed mode value; setting the system property with surrounding whitespace or wrong case; using 'packaged' with an older plugin version that doesn't support it.

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/8d5e877d0952be16. Report an issue: GitHub.