{"record":{"id":"a4ce5ac3c9404667","repo":"apache/maven","slug":"unable-to-store-local-copy-of-metadata","errorCode":null,"errorMessage":"Unable to store local copy of metadata: {}","messagePattern":"Unable to store local copy of metadata: (.+?)","errorType":"exception","errorClass":"RepositoryMetadataResolutionException","httpStatus":null,"severity":"warning","filePath":"compat/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java","lineNumber":157,"sourceCode":"                                        + \" due to an error: \" + e.getMessage());\n                        getLogger().debug(\"Exception\", e);\n                    } finally {\n                        updateCheckManager.touch(metadata, repository, file);\n                    }\n                }\n\n                // TODO should this be inside the above check?\n                // touch file so that this is not checked again until interval has passed\n                if (file.exists()) {\n                    file.setLastModified(System.currentTimeMillis());\n                }\n            }\n        }\n\n        try {\n            mergeMetadata(metadata, remoteRepositories, localRepo);\n        } catch (RepositoryMetadataStoreException e) {\n            throw new RepositoryMetadataResolutionException(\n                    \"Unable to store local copy of metadata: \" + e.getMessage(), e);\n        }\n    }\n\n    private Date getLocalCopyLastModified(ArtifactRepository localRepository, RepositoryMetadata metadata) {\n        String metadataPath = localRepository.pathOfLocalRepositoryMetadata(metadata, localRepository);\n        File metadataFile = new File(localRepository.getBasedir(), metadataPath);\n        return metadataFile.isFile() ? new Date(metadataFile.lastModified()) : null;\n    }\n\n    private void mergeMetadata(\n            RepositoryMetadata metadata,\n            List<ArtifactRepository> remoteRepositories,\n            ArtifactRepository localRepository)\n            throws RepositoryMetadataStoreException {\n        // TODO currently this is first wins, but really we should take the latest by comparing either the\n        // snapshot timestamp, or some other timestamp later encoded into the metadata.\n        // TODO this needs to be repeated here so the merging doesn't interfere with the written metadata","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/compat/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java#L139-L175","documentation":"Slf4jMavenTransferListener.transferCorrupted fires when the resolver reports a corrupted transfer (checksum mismatch observed during a download). The warning shows the underlying exception message plus the repository id, URL, and resource path; the download itself subsequently fails or is retried according to the repository checksum policy.","triggerScenarios":"Checksum verification failure while downloading, surfaced through the default CLI logging (visible when progress output is enabled, hidden by --no-transfer-progress).","commonSituations":"Mirrors or proxies serving truncated files; local repository holding a partial download; repositories with stale .sha1/.md5 files.","solutions":["Delete the partially downloaded artifact directory from the local repository and retry with -U","Compare checksums manually to see which side is wrong: sha1sum of the local file versus the remote .sha1 fetched with curl","Switch to a healthy mirror of Central if the repository keeps serving corrupt files","Set checksumPolicy=fail to turn silent corruption into an explicit build error"],"exampleFix":"# before\nmvn clean install   # warns during download: Checksum failed ... from central\n# after\nclean=$(find ~/.m2/repository -path '*com/example/artifact/1.0' -type d); rm -rf $clean\nmvn -U clean install","handlingStrategy":"retry","validationCode":"dir=~/.m2/repository/com/example/artifact/1.0\ncurrent=$(sha1sum $dir/artifact-1.0.jar 2>/dev/null | cut -d' ' -f1)\nexpected=$(cat $dir/artifact-1.0.jar.sha1 2>/dev/null)\n[ \"$current\" = \"$expected\" ] || rm -rf $dir   # force clean re-download","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run CI with checksumPolicy=fail so corruption fails loudly instead of warning","Remove partially downloaded artifacts before entering offline periods","Report persistent corruption to the repository administrator"],"tags":["maven","checksum","transfer","integrity","maven-embedder"],"backgroundTag":"checksum-mismatch","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}