Skip to content

Publish-Module failing for 4 part version with a trailing .0 #217

Closed

Description

Starting today we are getting the following publish error:

Failed to publish module 'AWSPowerShell': 'nuget.exe failed to push Response status code does not indicate success: 400 (The package is invalid. The error encountered was:'Nuspec version 4.1.31 and PowerShell module manifest 4.1.31.0 version are mismatched'. Correct the error and try again.).

The versions are the same and we have always uploaded the 4 part versions with the trailing .0. The command runs, uploads to PowerShell Gallery where the nuspec appears to be created and then fails on a version check.

The module installs and is usable locally. Did version checking change? Is this an accurate error message?

UPDATE:

We changed our code to strip the .0 on a 4 part version to 3 parts and modules are publishing. However, this is a breaking change in behavior. I imagine any customers that are publishing 4 part versions with a trailing .0 are no longer able to publish.

Activity

  1. changed the title [-]Publish-Module failing for same version but with a trailing .0[/-] [+]Publish-Module failing for 4 part version with a trailing .0[/+] on Feb 25, 2022
  2. floh96 commented on Feb 26, 2022

    @floh96
  3. petrsnd commented on Mar 3, 2022

    @petrsnd

    I have been publishing a PowerShell module for several years now. My method for publishing "-pre" tagged prerelease modules between released versions has worked until just recently when my pipeline began failing. Publish-Module is failing to publish if I have a prerelease tag with this mismatch message.

    I believe a bug has been introduced, because my module definition conforms to the guidance here:
    https://docs.microsoft.com/en-us/powershell/scripting/gallery/concepts/module-prerelease-support?view=powershell-7.2

    Error message:

    ##[error]Publish-PSArtifactUtility : Failed to publish module 'safeguard-ps': 'nuget.exe failed to push Response status code 
    does not indicate success: 400 (The package is invalid. The error encountered was:'Nuspec version 6.13.48351-pre and 
    PowerShell module manifest 6.13.48351 version are mismatched'. Correct the error and try again.).
    '.
    At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:10990 char:17
    + ...             Publish-PSArtifactUtility @PublishPSArtifactUtility_Param ...
    +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [Write-Error], WriteErrorException
        + FullyQualifiedErrorId : FailedToPublishTheModule,Publish-PSArtifactUtility
    ##[error]PowerShell exited with code '1'.
    

    My .psd1 file contains the following:

    @{
    ModuleVersion = '6.13.48351'
    PrivateData = @{
        PSData = @{
            Prerelease = '-pre'
        }
    }
    
  4. SydneyhSmith commented on Mar 7, 2022

    @SydneyhSmith
    Contributor

    Thank you both for posting this issue and for calling attention to this! Also apologies for the delay in response-- appreciate the patience!

    Dan Peterson (@petrsnd) if you update your script to Prerelease = 'pre' (ie take out the "-") it should publish okay, I will update the docs to make sure this is more clear....this has actually always been the intention but it looks like we had a longstanding bug which allowed the - and was inadvertently fixed when making updates to our publishing...apologies for all the confusion and time this stole trying to debug this issue!

    Bo Blodgett (@boblodgett) you are correct on the current work around for this-- we are working on a bug fix for this. Apologies for the trouble this caused!

  5. BethanyZhou commented on Mar 8, 2022

    @BethanyZhou

    Hi Sydney Smith (@SydneyhSmith) , Azure PowerShell team met this issue as well. Error message is as below:

    NuGet Version: 4.7.1.5393
    Pushing Az.Storage.4.3.1-preview.nupkg to 'https://www.poshtestgallery.com/api/v2/package/'...
    PUT https://www.poshtestgallery.com/api/v2/package/
    BadRequest https://www.poshtestgallery.com/api/v2/package/ 6624ms
    Response status code does not indicate success: 400 (The package is invalid. The error encountered was:'Nuspec version 4.3.1-preview cast as 4.3.1.0 and PowerShell module manifest 4.3.1 version are mismatched'. Correct the error and try again.).

    Please let me know when this bug is fixed.

  6. boblodgett commented on Mar 8, 2022

    @boblodgett
    Author

    Sydney Smith (@SydneyhSmith) It looks like today the PowerShell Gallery team has tried a fix but it broke normal 3 digit version publishing?

    We are now getting this error from using normal 3 digit versions:

    196 | Failed to publish module 'AWSPowerShell': 'nuget.exe failed to push Response status code does not indicate success: 400 (The package is invalid. The error encountered was:'Nuspec version 4.1.39 cast as 4.1.39.0 and PowerShell module manifest 4.1.39 version are mismatched'. Correct the error and try again.).
    197 | '.
    198 | Fatal error publishing C:\codebuild\tmp\output\src214205391\src\PRIVATE-aws-tools-for-powershell-staging\Deployment\AWSPowerShell
    199 | Write-Error: C:\program files\powershell\7\Modules\PowerShellGet\PSModule.psm1:10990
    200 | Line |
    201 | 10990 | . Publish-PSArtifactUtility @PublishPSArtifactUtility_Param .
    202 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    203 | | Failed to publish module 'AWSPowerShell': 'nuget.exe failed to push Response status code does not
    204 | | indicate success: 400 (The package is invalid. The error encountered was:'Nuspec version 4.1.39 cast
    205 | | as 4.1.39.0 and PowerShell module manifest 4.1.39 version are mismatched'. Correct the error and try

  7. peombwa commented on Mar 9, 2022

    @peombwa

    Hi Sydney Smith (@SydneyhSmith), Microsoft Graph PowerShell SDK team is also encountering this error when publishing to https://www.powershellgallery.com/api/v2/package/.

    2022-03-09T00:24:23.7154908Z Response status code does not indicate success: 400 (The package is invalid. The error encountered was:'Nuspec version 1.9.3 cast as 1.9.3.0 and PowerShell module manifest 1.9.3 version are mismatched'. Correct the error and try again.).
    2022-03-09T00:24:23.7156166Z System.Net.Http.HttpRequestException: Response status code does not indicate success: 400 (The package is invalid. The error encountered was:'Nuspec version 1.9.3 cast as 1.9.3.0 and PowerShell module manifest 1.9.3 version are mismatched'. Correct the error and try again.).
  8. SydneyhSmith commented on Mar 9, 2022

    @SydneyhSmith
    Contributor

    Apologies for all of the issues-- we are working to resolve this bug ASAP

  9. jformacek commented on Mar 9, 2022

    @jformacek

    Having same problem with 3 digit version of module. Did not find workaround so far. Thanks for fixing ASAP.

  10. anamnavi commented on Mar 10, 2022

    @anamnavi
    Member

    This bug with versioning is now fixed. Thanks for everyone's patience on this and sorry for any inconvenience it caused! 3 digit and 4 digit versions both work, and prerelease versions when you specify the prelease value shouldn't contain "-" in the string (as per Sydney Smith (@SydneyhSmith) comment above). We are updating the docs asap too. Please let us know if any issue is still faced wrt to this. Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions