GoogleContainerTools/jib · error · UnknownManifestFormatException

Unknown mediaType: + mediaType

Error message

Unknown mediaType: + mediaType

What it means

Thrown by AbstractManifestPuller.getManifestTemplateFromJson when a schemaVersion 2 manifest carries a mediaType that Jib does not recognize (not Docker manifest/list or OCI manifest/index). Jib only supports a fixed set of media types and rejects anything else. It surfaces as UnknownManifestFormatException containing the offending mediaType string.

Source

Thrown at jib-core/src/main/java/com/google/cloud/tools/jib/registry/AbstractManifestPuller.java:185

      String mediaType = mediaTypeNode.asText();
      if (OciManifestTemplate.MANIFEST_MEDIA_TYPE.equals(mediaType)) {
        return manifestTemplateClass.cast(
            JsonTemplateMapper.readJson(jsonString, OciManifestTemplate.class));
      }
      if (V22ManifestTemplate.MANIFEST_MEDIA_TYPE.equals(mediaType)) {
        return manifestTemplateClass.cast(
            JsonTemplateMapper.readJson(jsonString, V22ManifestTemplate.class));
      }
      if (V22ManifestListTemplate.MANIFEST_MEDIA_TYPE.equals(mediaType)) {
        return manifestTemplateClass.cast(
            JsonTemplateMapper.readJson(jsonString, V22ManifestListTemplate.class));
      }
      if (OciIndexTemplate.MEDIA_TYPE.equals(mediaType)) {
        return manifestTemplateClass.cast(
            JsonTemplateMapper.readJson(jsonString, OciIndexTemplate.class));
      }
      throw new UnknownManifestFormatException("Unknown mediaType: " + mediaType);
    }
    throw new UnknownManifestFormatException(
        "Unknown schemaVersion: " + schemaVersion + " - only 1 and 2 are supported");
  }

  @Override
  public R handleHttpResponseException(ResponseException responseException)
      throws ResponseException, RegistryErrorException {
    throw responseException;
  }
}

View on GitHub (pinned to fb949e2676)

Solutions

  1. Verify the image reference points to a container image, not an OCI artifact (signature, SBOM, attestation).
  2. Upgrade Jib to the latest version, which recognizes more media types.
  3. Check the registry's mediaType in the raw manifest and confirm it is one of the supported Docker/OCI types.
  4. If your own registry serves custom media types, change them to standard image manifest types.

Example fix

// before
"mediaType": "application/vnd.example.custom.manifest"
// after
"mediaType": "application/vnd.oci.image.manifest.v1+json"
Defensive patterns

Strategy: validation

Validate before calling

// preflight: check the mediaType the tag resolves to
// curl -s <manifest-url> | jq -r '.mediaType'
// must be one of:
// application/vnd.docker.distribution.manifest.v2+json
// application/vnd.docker.distribution.manifest.list.v2+json
// application/vnd.oci.image.manifest.v1+json
// application/vnd.oci.image.index.v1+json

Try / catch

// catch and explain unsupported media types
try {
    jibContainerBuilder.containerize();
} catch (RegistryErrorException e) {
    if (e.getMessage().contains("Unknown mediaType")) {
        throw new IllegalStateException("Tag points to a non-image artifact or unsupported media type — verify the reference", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Registry returns a manifest whose mediaType field is a custom value, an artifact (e.g. an attestation, SBOM, or cosign signature manifest), or a newer format not supported by this Jib version.

Common situations: Pulling a tag that resolves to a non-image artifact (cosign attestations, Helm charts stored as OCI artifacts), or using an old Jib version against a registry that serves newer OCI media types.

Related errors


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