{"record":{"id":"b09f8a6b2ae6de48","repo":"spinnaker/spinnaker","slug":"unable-to-download-artifact-with-reference-refer","errorCode":null,"errorMessage":"Unable to download artifact with reference '<reference>'. HTTP <code>","messagePattern":"Unable to download artifact with reference '<reference>'\\. HTTP <code>","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"clouddriver/clouddriver-artifacts/clouddriver-artifacts-maven/src/main/java/com/netflix/spinnaker/clouddriver/artifacts/maven/MavenArtifactCredentials.java","lineNumber":120,"sourceCode":"                      repositoryLayout.getLocation(withVersion(requestedArtifact, version), false))\n              .map(URI::getPath)\n              .orElseThrow(\n                  () ->\n                      new IllegalStateException(\n                          \"No versions matching constraint '\"\n                              + artifact.getVersion()\n                              + \"' for '\"\n                              + artifact.getReference()\n                              + \"'\"));\n\n      Request artifactRequest =\n          new Request.Builder().url(account.getRepositoryUrl() + \"/\" + artifactPath).get().build();\n\n      Response artifactResponse = okHttpClient.newCall(artifactRequest).execute();\n      if (artifactResponse.isSuccessful()) {\n        return artifactResponse.body().byteStream();\n      }\n      throw new IllegalStateException(\n          \"Unable to download artifact with reference '\"\n              + artifact.getReference()\n              + \"'. HTTP \"\n              + artifactResponse.code());\n    } catch (IOException | ArtifactDownloadException e) {\n      throw new IllegalStateException(\n          \"Unable to download artifact with reference '\" + artifact.getReference() + \"'\", e);\n    }\n  }\n\n  public Optional<String> resolveArtifactName(Artifact artifact) {\n    try {\n      final DefaultArtifact aetherArtifact = new DefaultArtifact(artifact.getReference());\n      return Optional.of(aetherArtifact.getGroupId() + \":\" + aetherArtifact.getArtifactId());\n    } catch (Exception e) {\n      return Optional.empty();\n    }\n  }","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/spinnaker/spinnaker/blob/1d4a5d0f6d10d0232b1af077decd559b68a94a5e/clouddriver/clouddriver-artifacts/clouddriver-artifacts-maven/src/main/java/com/netflix/spinnaker/clouddriver/artifacts/maven/MavenArtifactCredentials.java#L102-L138","documentation":"Thrown by MavenArtifactCredentials.download when the HTTP request to the Maven repository for the artifact file returns a non-success status code (e.g. 401, 403, 404). The reference and HTTP status are included so the caller can tell whether the coordinates, credentials, or repository layout are wrong. It is an IllegalStateException rather than a declared exception because failure to fetch a pinned artifact is considered unrecoverable at this layer.","triggerScenarios":"Calling download(artifact) on a Maven artifact account where repositoryUrl + '/' + artifactPath returns HTTP >= 400: the artifact version does not exist in the repo, the credentials lack read access, or the repository URL is wrong/mis-proxied.","commonSituations":"Typo in groupId/artifactId/version in a pipeline artifact reference; anonymous access disabled but no username/password configured; corporate Artifactory/Nexus proxying returning 401; artifact deleted by a snapshot-cleanup policy.","solutions":["Verify the artifact reference (groupId:artifactId:version) resolves by fetching the same path manually with curl using the same credentials","Check the Maven artifact account's username/password and repositoryUrl in clouddriver config for correctness and read permission","Confirm the artifact still exists in the repository (snapshots may have been purged) and re-pin a valid version","Check proxy/VPN/network settings if the repository is only reachable from certain networks"],"exampleFix":"// before\nMavenArtifactCredentials creds = new MavenArtifactCredentials(account with wrong password);\nInputStream is = creds.download(artifact);\n// after\nMavenArtifactAccount fixedAccount = account.toBuilder()\n    .username(\"correct-user\").password(\"correct-token\").build();\nMavenArtifactCredentials creds = new MavenArtifactCredentials(fixedAccount);\n// pre-check\nassert creds.resolveArtifactName(artifact).isPresent();","handlingStrategy":"validation","validationCode":"// Verify the artifact resolves before downloading\nif (!creds.resolveArtifactName(artifact).isPresent()) {\n  throw new IllegalStateException(\"Artifact not resolvable in repository: \" + artifact.getReference());\n}","typeGuard":null,"tryCatchPattern":"try {\n  stream = creds.download(artifact);\n} catch (IllegalStateException e) {\n  if (e.getMessage().contains(\"HTTP 40\")) { /* fix reference or credentials, no retry */ }\n  else { /* transient, may retry with backoff */ }\n}","preventionTips":["Pre-resolve the artifact with resolveArtifactVersion/resolveArtifactName before download","Keep Maven account credentials in a secret store and rotate before expiry","Pin release versions rather than purged snapshots","Test repositoryUrl with curl from the clouddriver host after config changes"],"tags":["maven","http-404","artifact-download","network"],"backgroundTag":"http-error-response","analyzedSha":"1d4a5d0f6d10d0232b1af077decd559b68a94a5e","analyzedAt":"2026-09-10T14:13:07.222Z","contentChangedAt":"2026-09-10T14:13:07.222Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}