{"record":{"id":"b9c0606d1190f116","repo":"GoogleContainerTools/jib","slug":"tried-to-actiondescription-but-failed-because","errorCode":null,"errorMessage":"Tried to ${actionDescription} but failed because: ${registryErrorReasons}","messagePattern":"Tried to (.+?) but failed because: (.+?)","errorType":"exception","errorClass":"RegistryErrorException","httpStatus":null,"severity":"error","filePath":"jib-core/src/main/java/com/google/cloud/tools/jib/registry/RegistryEndpointCaller.java","lineNumber":153,"sourceCode":"            .setAuthorization(authorization);\n\n    try (Response response =\n        httpClient.call(registryEndpointProvider.getHttpMethod(), url, requestBuilder.build())) {\n\n      return registryEndpointProvider.handleResponse(response);\n\n    } catch (ResponseException ex) {\n      // First, see if the endpoint provider handles an exception as an expected response.\n      try {\n        return registryEndpointProvider.handleHttpResponseException(ex);\n\n      } catch (ResponseException responseException) {\n        if (responseException.getStatusCode() == HttpStatusCodes.STATUS_CODE_BAD_REQUEST\n            || responseException.getStatusCode() == HttpStatusCodes.STATUS_CODE_NOT_FOUND\n            || responseException.getStatusCode()\n                == HttpStatusCodes.STATUS_CODE_METHOD_NOT_ALLOWED) {\n          // The name or reference was invalid.\n          throw newRegistryErrorException(responseException);\n\n        } else if (responseException.getStatusCode() == HttpStatusCodes.STATUS_CODE_FORBIDDEN) {\n          throw new RegistryUnauthorizedException(serverUrl, imageName, responseException);\n\n        } else if (responseException.getStatusCode() == HttpStatusCodes.STATUS_CODE_UNAUTHORIZED) {\n          if (responseException.requestAuthorizationCleared()) {\n            throw new RegistryCredentialsNotSentException(serverUrl, imageName);\n          } else {\n            // Credentials are either missing or wrong.\n            throw new RegistryUnauthorizedException(serverUrl, imageName, responseException);\n          }\n\n        } else {\n          // Unknown\n          throw responseException;\n        }\n      }\n","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-core/src/main/java/com/google/cloud/tools/jib/registry/RegistryEndpointCaller.java#L135-L171","documentation":"Jib wraps registry HTTP response exceptions into a RegistryErrorException. For 400, 404, and 405 responses it concludes the image name or reference (tag/digest) was invalid, and the thrown error aggregates the attempted action description with all underlying registry error reasons from the response body.","triggerScenarios":"Any registry endpoint call (manifest pull/push, blob operations) that receives a 400 Bad Request, 404 Not Found, or 405 Method Not Allowed response.","commonSituations":"Typo in image name, repository, or tag; referencing a tag/digest that does not exist; pushing to a repository path the registry rejects as invalid; registry not supporting a requested operation.","solutions":["Verify the image reference (registry/repository:tag) is spelled correctly and exists (check with docker pull or the registry UI)","Check tag/digest casing and allowed characters for the registry","Confirm the repository exists and your account has pull/push access","Inspect the included registryErrorReasons in the message for the registry's own explanation"],"exampleFix":"// before\nmvn jib:build -Dimage=myregistry.io/my-Project:Latest\n// after\nmvn jib:build -Dimage=myregistry.io/my-project:latest","handlingStrategy":"try-catch","validationCode":"// validate the reference locally before building\nif (!imageRef.matches(\"[a-z0-9]+(\\.[a-z0-9]+)*(:\\d+)?/[a-z0-9._/-]+(:[a-zA-Z0-9._-]+)?\")) {\n  throw new IllegalArgumentException(\"Invalid image reference: \" + imageRef);\n}","typeGuard":"boolean isValidImageRef(String ref) {\n  return ref != null && ref.matches(\"[a-z0-9]+([._-][a-z0-9]+)*(:\\d+)?(/[a-z0-9._/-]+)+(:[\\w.-]+)?\");\n}","tryCatchPattern":"try {\n  jibBuild.containerize(...);\n} catch (RegistryErrorException e) {\n  // message contains action + aggregated registryErrorReasons\n  System.err.println(\"Image/reference rejected by registry: \" + e.getMessage());\n  verifyImageNameAndTag(e);\n}","preventionTips":["Verify the image tag exists with docker pull before CI builds","Use lowercase repository names and valid tag characters","Confirm registry permissions for the account doing pull/push","Log the full RegistryErrorException message; it embeds the registry's own reasons"],"tags":["registry","docker","http","image-reference"],"backgroundTag":"http-error-response","analyzedSha":"fb949e2676afbbd7dd7a1ef61e20251931325654","analyzedAt":"2026-09-06T14:04:09.491Z","contentChangedAt":"2026-09-06T14:04:09.491Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}