{"record":{"id":"3dadf3565c9c48f2","repo":"apache/maven","slug":"invalid-artifact-version","errorCode":null,"errorMessage":"Invalid artifact version {}: {}","messagePattern":"Invalid artifact version (.+?): (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"compat/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java","lineNumber":215,"sourceCode":"                } else {\n                    throw new ArtifactResolutionException(e.getMessage(), artifact, remoteRepositories, e);\n                }\n            }\n\n            artifact.selectVersion(result.getArtifact().getVersion());\n            artifact.setFile(result.getArtifact().getFile());\n            artifact.setResolved(true);\n\n            if (artifact.isSnapshot()) {\n                Matcher matcher = Artifact.VERSION_FILE_PATTERN.matcher(artifact.getVersion());\n                if (matcher.matches()) {\n                    Snapshot snapshot = new Snapshot();\n                    snapshot.setTimestamp(matcher.group(2));\n                    try {\n                        snapshot.setBuildNumber(Integer.parseInt(matcher.group(3)));\n                        artifact.addMetadata(new SnapshotArtifactRepositoryMetadata(artifact, snapshot));\n                    } catch (NumberFormatException e) {\n                        logger.warn(\"Invalid artifact version \" + artifact.getVersion() + \": \" + e.getMessage());\n                    }\n                }\n            }\n        }\n    }\n\n    @Override\n    public ArtifactResolutionResult resolveTransitively(\n            Set<Artifact> artifacts,\n            Artifact originatingArtifact,\n            ArtifactRepository localRepository,\n            List<ArtifactRepository> remoteRepositories,\n            ArtifactMetadataSource source,\n            ArtifactFilter filter)\n            throws ArtifactResolutionException, ArtifactNotFoundException {\n        return resolveTransitively(\n                artifacts,\n                originatingArtifact,","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/compat/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java#L197-L233","documentation":"Warning from DefaultArtifactResolver.resolve when a resolved SNAPSHOT artifact's version matches Artifact.VERSION_FILE_PATTERN (timestamped snapshot like 1.0-20260821.123456-7): group(3) should be the build number, but Integer.parseInt on it throws NumberFormatException. Maven logs 'Invalid artifact version' and simply skips attaching SnapshotArtifactRepositoryMetadata (build number/timestamp metadata) for that artifact; resolution itself is not rolled back.","triggerScenarios":"A snapshot artifact version string whose suffix after the timestamp is non-numeric, e.g. 1.0-20260821.123456-x or 1.0-20260821.123456- (empty), reaches resolve(). This typically means a hand-crafted version in a dependency declaration, a mirror rewriting version strings, or a repository serving malformed snapshot filenames that got installed into the local repo.","commonSituations":"Manually pinned timestamped snapshot versions in pom.xml with typos; dependency:go-offline or scripts fabricating version strings; custom repository managers that mangle snapshot filenames; migrating from formats like -SNAPSHOT-1 to pure timestamped forms incorrectly.","solutions":["Locate the declaration: mvn dependency:tree -Dverbose and grep for the malformed timestamped version; correct it to a proper -SNAPSHOT or a well-formed timestamped version (-N with numeric N).","If the bad artifact sits in the local repository, delete that artifact's directory and re-resolve from a clean source.","Check mirrors/repository rewriting rules (Nexus/Artifactory version policies) that could alter snapshot filenames.","Regenerate any scripts that construct version strings to enforce the <base>-<timestamp>-<buildNumber> format."],"exampleFix":"<!-- before -->\n<version>1.2-20260821.101010-abc</version>\n<!-- after: rely on snapshot metadata -->\n<version>1.2-SNAPSHOT</version>","handlingStrategy":"validation","validationCode":"private static final Pattern TS = Pattern.compile(\"^(.*)-(\\\\d{8}\\\\.\\\\d{6})-(\\\\d+)$\");\nboolean wellFormedSnapshotVersion(String v) { return TS.matcher(v).matches(); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Reference snapshots as <version>X.Y-SNAPSHOT</version>; let Maven expand timestamped forms.","Delete hand-forged timestamped artifacts from the local repo when seen.","Audit custom version-rewriting plugins/mirrors for malformed suffixes."],"tags":["maven","snapshot","version","metadata","number-format"],"backgroundTag":"invalid-artifact-version","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}