Uploading npm snapshots results in java.lang.NumberFormatException: For input string: "20221105141116"

Good morning,
after upgrading from 3.40 to 3.42, we are not able to upload npm artifacts (snapshots) to Nexus OSS hosted repo.
npm publish creates an artifact with version number as 1.0.0-test.20221105141116.1273f29, with the following:

  • version number (1.0.0)
  • environment (test)
  • timestamp (20221105141116)
  • short commit id (1273f29)

This is what we get after execution:

npm publish
npm notice 
npm notice package: web-collaboration-client@1.0.0-test.20221105141116.1273f29
npm notice === Tarball Contents === 
npm notice 42B     build/.version                                            
npm notice 3.4kB   build/orchestrator/web-collaboration-client.css           
npm notice 3.4kB   build/web-collaboration-client.css                        
npm notice 3.6kB   build/index.html                                          
npm notice 3.6kB   build/orchestrator/index.html                             
npm notice 243.6kB build/orchestrator/web-collaboration-client.js            
npm notice 1.5MB   build/web-collaboration-client.js                         
npm notice 2.7kB   package.json                                              
npm notice 5.5kB   build/orchestrator/web-collaboration-client.css.map       
npm notice 5.5kB   build/web-collaboration-client.css.map                    
npm notice 619.8kB build/orchestrator/web-collaboration-client.js.map        
npm notice 3.8MB   build/web-collaboration-client.js.map                     
npm notice 494B    build/orchestrator/web-collaboration-client.js.LICENSE.txt
npm notice 2.4kB   build/web-collaboration-client.js.LICENSE.txt             
npm notice === Tarball Details === 
npm notice name:          web-collaboration-client                
npm notice version:       1.0.0-test.20221105141116.1273f29       
npm notice package size:  1.5 MB                                  
npm notice unpacked size: 6.1 MB                                  
npm notice shasum:        3354ba0f1d0c4497b087348038c8012ea9d45801
npm notice integrity:     sha512-TuY/+yHFB9bmg[...]4mkfQ41FFF2JA==
npm notice total files:   14                                      
npm notice 
npm ERR! code E400
npm ERR! 400 Bad Request - PUT https://nexusrepo.example.com/nexus/repository/react-private-snapshots/web-collaboration-client - For input string: "20221105141116"

Nexus OSS throws a java exception:

2022-11-05 15:12:06,589+0100 WARN  [qtp580124277-536]  jenkins-user com.sonatype.nexus.repository.npm.internal.NpmHandlers - Error: PUT /web-collaboration-client: Status{successful=false, code=400, message='null'} - For input string: "20221105141116"
java.lang.NumberFormatException: For input string: "20221105141116"
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
        at java.lang.Integer.parseInt(Integer.java:583)
        at java.lang.Integer.valueOf(Integer.java:766)
        at com.sonatype.nexus.repository.npm.internal.NpmFormatAttributesExtractor.getSearchNormalizedVersion(NpmFormatAttributesExtractor.java:297)

From what I see, it seems nexus has an internal format validator, expecting the version to be normalized, but I cannot find anything in documentation nor online.
Is there a way to find how to format version field?

Thank you very much.


Hi all,
I found the same issue on Jira: [NEXUS-35486] Unable to Upload npm package with long buildnumber - Sonatype JIRA