GoogleContainerTools/jib · error · MojoFailureException

<format> parameter is configured with value '<format>', but

Error message

<format> parameter is configured with value '<format>', but the only valid configuration options are 'Docker' and 'OCI'.

What it means

BuildImageMojo.execute() validates the <format> configuration parameter against the ImageFormat enum names ('Docker' and 'OCI') and throws a MojoFailureException when the configured value matches neither. This is a fail-fast configuration check so users get a clear message instead of a downstream failure during image building.

Source

Thrown at jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/BuildImageMojo.java:72

    name = BuildImageMojo.GOAL_NAME,
    requiresDependencyResolution = ResolutionScope.RUNTIME_PLUS_SYSTEM,
    threadSafe = true)
public class BuildImageMojo extends JibPluginConfiguration {

  @VisibleForTesting static final String GOAL_NAME = "build";

  private static final String HELPFUL_SUGGESTIONS_PREFIX = "Build image failed";

  @Override
  public void execute() throws MojoExecutionException, MojoFailureException {
    checkJibVersion();
    if (MojoCommon.shouldSkipJibExecution(this)) {
      return;
    }

    // Validates 'format'.
    if (Arrays.stream(ImageFormat.values()).noneMatch(value -> value.name().equals(getFormat()))) {
      throw new MojoFailureException(
          "<format> parameter is configured with value '"
              + getFormat()
              + "', but the only valid configuration options are '"
              + ImageFormat.Docker
              + "' and '"
              + ImageFormat.OCI
              + "'.");
    }

    // Parses 'to' into image reference.
    if (Strings.isNullOrEmpty(getTargetImage())) {
      throw new MojoFailureException(
          HelpfulSuggestions.forToNotConfigured(
              "Missing target image parameter",
              "<to><image>",
              "pom.xml",
              "mvn compile jib:build -Dimage=<your image name>"));
    }

View on GitHub (pinned to fb949e2676)

Solutions

  1. Set <format> to exactly 'Docker' or 'OCI' (case-sensitive) in pom.xml or pass -Dformat=OCI.
  2. If you meant to build to the Docker daemon, use jib:dockerBuild instead of setting <format>.
  3. Remove the <format> element entirely to use the default format.

Example fix

<!-- before -->
<format>docker</format>
<!-- after -->
<format>Docker</format>
Defensive patterns

Strategy: validation

Validate before calling

String format = System.getProperty("format", pomFormat);
if (format != null && !format.equals("Docker") && !format.equals("OCI")) {
  throw new IllegalArgumentException("<format> must be 'Docker' or 'OCI', got: " + format);
}

Try / catch

catch (MojoFailureException e) { System.err.println(e.getMessage()); /* fix <format> in pom or -Dformat */ }

Prevention

When it happens

Trigger: Running 'mvn jib:build' (or jib:dockerBuild/jib:buildTar which share this mojo path) with <format> set to a value that is not exactly 'Docker' or 'OCI' — e.g. 'docker', 'oci', 'DockerFormat', or a typo.

Common situations: Typo in pom.xml <format>; assuming the value is case-insensitive ('docker' fails); copying a config from another tool that uses lowercase format names; YAML/properties injection producing unexpected values.

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/08a6dab82b3e7424. Report an issue: GitHub.