{"record":{"id":"843074b65b19ea14","repo":"GoogleContainerTools/jib","slug":"schemaversion-field-is-not-an-integer","errorCode":null,"errorMessage":"'schemaVersion' field is not an integer","messagePattern":"'schemaVersion' field is not an integer","errorType":"exception","errorClass":"UnknownManifestFormatException","httpStatus":null,"severity":"error","filePath":"jib-core/src/main/java/com/google/cloud/tools/jib/registry/AbstractManifestPuller.java","lineNumber":145,"sourceCode":"        + registryEndpointRequestProperties.getImageName()\n        + \":\"\n        + imageQualifier;\n  }\n\n  /**\n   * Instantiates a {@link ManifestTemplate} from a JSON string. This checks the {@code\n   * schemaVersion} field of the JSON to determine which manifest version to use.\n   */\n  private T getManifestTemplateFromJson(String jsonString)\n      throws IOException, UnknownManifestFormatException {\n    ObjectNode node = new ObjectMapper().readValue(jsonString, ObjectNode.class);\n    if (!node.has(\"schemaVersion\")) {\n      throw new UnknownManifestFormatException(\"Cannot find field 'schemaVersion' in manifest\");\n    }\n\n    int schemaVersion = node.get(\"schemaVersion\").asInt(-1);\n    if (schemaVersion == -1) {\n      throw new UnknownManifestFormatException(\"'schemaVersion' field is not an integer\");\n    }\n\n    if (schemaVersion == 1) {\n      return manifestTemplateClass.cast(\n          JsonTemplateMapper.readJson(jsonString, V21ManifestTemplate.class));\n    }\n    if (schemaVersion == 2) {\n      // 'schemaVersion' of 2 can be either Docker V2.2 or OCI.\n      JsonNode mediaTypeNode = node.get(\"mediaType\");\n      if (mediaTypeNode == null) { // not Docker, hence OCI\n        if (node.get(\"manifests\") != null) {\n          return manifestTemplateClass.cast(\n              JsonTemplateMapper.readJson(jsonString, OciIndexTemplate.class));\n        }\n        if (node.get(\"config\") != null) {\n          return manifestTemplateClass.cast(\n              JsonTemplateMapper.readJson(jsonString, OciManifestTemplate.class));\n        }","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-core/src/main/java/com/google/cloud/tools/jib/registry/AbstractManifestPuller.java#L127-L163","documentation":"Thrown by AbstractManifestPuller.getManifestTemplateFromJson when the manifest's 'schemaVersion' field exists but is not an integer (asInt(-1) returns the -1 sentinel). Jib branches on the integer schema version (1 or 2), so a string/boolean/null value makes the manifest unclassifiable. It surfaces as UnknownManifestFormatException.","triggerScenarios":"A registry returns a manifest where 'schemaVersion' is a string like \"2\" or \"latest\", a JSON object, or null rather than a JSON number.","commonSituations":"Custom or misbehaving registry implementations, middleware rewriting manifest JSON, or hand-crafted mock registries used in CI.","solutions":["Inspect the manifest JSON returned by the registry and confirm schemaVersion is a numeric value (e.g. 2).","Fix or replace the registry/proxy that is emitting a non-integer schemaVersion.","If using a mock registry in tests, update its fixture manifests to include an integer schemaVersion."],"exampleFix":"// before\n{\"schemaVersion\": \"2\", ...}\n// after\n{\"schemaVersion\": 2, ...}","handlingStrategy":"try-catch","validationCode":"// preflight: schemaVersion must be an integer\n// curl -s https://registry.example.com/v2/<image>/manifests/<tag> | jq '.schemaVersion | type'\n// expect: \"number\"","typeGuard":null,"tryCatchPattern":"// catch and diagnose nonconforming registry responses\ntry {\n    jibContainerBuilder.containerize();\n} catch (RegistryErrorException e) {\n    if (e.getMessage().contains(\"not an integer\")) {\n        throw new IllegalStateException(\"Registry returned a manifest with non-integer schemaVersion — registry or proxy is nonconforming\", e);\n    }\n    throw e;\n}","preventionTips":["Avoid custom registry middleware that rewrites manifest JSON fields.","Keep test-fixture manifests with numeric schemaVersion values.","Pin known-good registry versions in your infrastructure."],"tags":["docker-registry","manifest","registry-protocol"],"backgroundTag":"unexpected-response-shape","analyzedSha":"fb949e2676afbbd7dd7a1ef61e20251931325654","analyzedAt":"2026-09-06T14:04:09.491Z","contentChangedAt":"2026-09-06T14:04:09.491Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}