{"record":{"id":"af8ca59d50a919d6","repo":"GoogleContainerTools/jib","slug":"received-unrecognized-status-code-statuscode","errorCode":null,"errorMessage":"Received unrecognized status code ${statusCode}","messagePattern":"Received unrecognized status code (.+?)","errorType":"exception","errorClass":"RegistryErrorException","httpStatus":null,"severity":"error","filePath":"jib-core/src/main/java/com/google/cloud/tools/jib/registry/BlobPusher.java","lineNumber":84,"sourceCode":"      return Collections.emptyList();\n    }\n\n    /**\n     * Returns a URL to continue pushing the BLOB to, or {@link Optional#empty()} if the BLOB\n     * already exists on the registry.\n     */\n    @Override\n    public Optional<URL> handleResponse(Response response) throws RegistryErrorException {\n      switch (response.getStatusCode()) {\n        case HttpURLConnection.HTTP_CREATED:\n          // The BLOB exists in the registry.\n          return Optional.empty();\n\n        case HttpURLConnection.HTTP_ACCEPTED:\n          return Optional.of(getRedirectLocation(response));\n\n        default:\n          throw buildRegistryErrorException(\n              \"Received unrecognized status code \" + response.getStatusCode());\n      }\n    }\n\n    @Override\n    public URL getApiRoute(String apiRouteBase) throws MalformedURLException {\n      StringBuilder url =\n          new StringBuilder(apiRouteBase)\n              .append(registryEndpointRequestProperties.getImageName())\n              .append(\"/blobs/uploads/\");\n      if (sourceRepository != null) {\n        url.append(\"?mount=\").append(blobDigest).append(\"&from=\").append(sourceRepository);\n      }\n\n      return new URL(url.toString());\n    }\n\n    @Override","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-core/src/main/java/com/google/cloud/tools/jib/registry/BlobPusher.java#L66-L102","documentation":"During blob (layer) push, after sending the blob Jib expects either 201 Created (already exists), 202 with a Location header (resume/redirect), or 204. Any other status code is unexpected for the registry protocol and Jib throws a RegistryErrorException via buildRegistryErrorException.","triggerScenarios":"The registry returns an unexpected status code (anything other than 201, 202, or 204) in response to the PATCH/PUT blob-upload requests during image push.","commonSituations":"Non-standard or buggy private registry implementations; proxies or load balancers injecting 4xx/5xx responses mid-upload; registry rejecting the blob for quota or policy reasons with an unusual status.","solutions":["Check the registry server logs for the root cause of the unexpected status","Verify the registry is a spec-compliant Docker Registry v2 implementation","Bypass intermediate proxies that may rewrite upload responses","Retry the push; if persistent, test against a known-good registry (Docker Hub, GCR) to isolate the registry's behavior"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// preflight: check registry reachability and API version\ncurl -fsS https://registry:5000/v2/ || echo \"registry not v2-compliant\"","typeGuard":null,"tryCatchPattern":"try {\n  jibBuild.push();\n} catch (RegistryErrorException e) {\n  if (e.getMessage().contains(\"unrecognized status code\")) {\n    // retry once, else fail with registry diagnostics\n    retryPushOrReportRegistryLogs(e);\n  }\n}","preventionTips":["Use spec-compliant registries (Distribution registry:2, GCR, ECR, Docker Hub)","Test registry uploads with docker push before using Jib","Bypass or fix proxies that rewrite upload responses"],"tags":["registry","http","docker","push"],"backgroundTag":"unexpected-http-status","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"}