apache/maven · error · ResourceDoesNotExistException

Failure to resolve " + remotePath + " from " + repository.ge

Error message

Failure to resolve " + remotePath + " from " + repository.getUrl() + " was cached in the local repository. Resolution will not be reattempted until the update interval of " + repository.getId() + " has elapsed or updates are forced.

What it means

Thrown by the legacy DefaultWagonManager when the artifact file is absent locally, no update is required yet, and the update check manager has no recorded error for it. This is the ResourceDoesNotExistException twin of the cached-failure path: the previous check recorded 'not found' (touch(artifact, repository, null)) rather than an error, so Maven caches the absence itself and will not re-query the repository until the update interval elapses or updates are forced.

Source

Thrown at compat/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java:149

                            : e.getClass().getSimpleName();
                    updateCheckManager.touch(artifact, repository, error);
                    throw e;
                }

                logger.debug("  Artifact " + artifact.getId() + " resolved to " + artifact.getFile());

                artifact.setResolved(true);
            } else if (!artifact.getFile().exists()) {
                String error = updateCheckManager.getError(artifact, repository);
                if (error != null) {
                    throw new TransferFailedException("Failure to resolve " + remotePath + " from "
                            + repository.getUrl()
                            + " was cached in the local repository. "
                            + "Resolution will not be reattempted until the update interval of "
                            + repository.getId() + " has elapsed or updates are forced. Original error: " + error);

                } else {
                    throw new ResourceDoesNotExistException(
                            "Failure to resolve " + remotePath + " from " + repository.getUrl()
                                    + " was cached in the local repository. "
                                    + "Resolution will not be reattempted until the update interval of "
                                    + repository.getId() + " has elapsed or updates are forced.");
                }
            }
        }
    }

    @Override
    public void getArtifact(
            Artifact artifact,
            List<ArtifactRepository> remoteRepositories,
            TransferListener downloadMonitor,
            boolean force)
            throws TransferFailedException, ResourceDoesNotExistException {
        TransferFailedException tfe = null;

View on GitHub (pinned to e4093d4e12)

Solutions

  1. Re-run with -U to force a fresh check once the artifact should exist
  2. Verify the artifact/version actually exists in the repository it is being requested from (browse Nexus/Central)
  3. Delete the artifact's directory (and *.lastUpdated files) in the local repository to reset the state
  4. Check mirror/mirrorOf configuration - a catch-all mirror can 404 artifacts that live elsewhere
  5. For snapshots, ensure the deploy job finished before dependent builds start, or use 'always' updatePolicy

Example fix

# before
mvn package   # replays cached not-found
# after
mvn package -U
# or
rm -rf ~/.m2/repository/com/example/not-yet-published && mvn package
Defensive patterns

Strategy: retry

Validate before calling

// Before building, verify the artifact now exists remotely (it did not last check)
// e.g. HEAD <repoUrl>/path/to/artifact.jar returns 200, else skip build with clear message

Try / catch

catch (org.apache.maven.wagon.ResourceDoesNotExistException e) {
    if (e.getMessage() != null && e.getMessage().contains("was cached in the local repository")) {
        // not-found state is cached: purge the dir or force (-U) once the deploy is done
    }
}

Prevention

When it happens

Trigger: getArtifact() with force=false after a prior attempt ended in ResourceDoesNotExistException (HTTP 404, missing path): updateCheckManager.getError() returns null, so the not-found state is replayed as this exception instead.

Common situations: Snapshot/metadata 404s cached during repository maintenance windows; artifacts not yet published when the build first ran (race with a deployment job); typo'd version resolved against a mirror that silently 404s; CI agents retaining stale not-found state across runs.

Related errors


AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21). Data as JSON: /api/errors/ad5caf91ded8941f. Report an issue: GitHub.