azure-pipelines-tasks: [REGRESSION]: The nuget command failed with exit code(null) and error()
New issue checklist
- I searched for existing GitHub issues
- I read pipeline troubleshooting guide
- I checked how to collect logs
Task name
NuGetCommand
Breaking task version
2.244.1
Last working task version
2.238.1
Regression Description
Builds just started failing with The nuget command failed with exit code(null) and error().
When comparing failed and successful builds, noticed that the within ‘initialize job’, all of the failed jobs were using this newer task version 2.244.1. After forcing the task back to 2.238.1, builds became successful again
Environment type (Please select at least one enviroment where you face this issue)
- Self-Hosted
- Microsoft Hosted
- VMSS Pool
- Container
Azure DevOps Server type
dev.azure.com (formerly visualstudio.com)
Azure DevOps Server Version (if applicable)
No response
Operation system
windows-latest
Relevant log output
[only a tiny snippet of the end of the log]
Added file 'ManuScripts/DCTTemplates/CarrierProperty/MI/Carrier_Property_MI_00_35.xml'.
Added file 'ManuScripts/DCTTemplates/CarrierProperty/MI/Carrier_Property_MI_00_36.xml'.
Added file 'ManuScripts/DCTTemplates/CarrierProperty/MI/Carrier_Property_MI_00_37_01.xml'.
Added file 'ManuScripts/DCTTemplates/CarrierProperty/MI/Carrier_Property_MI_00_38.xml'.
Added file 'ManuScripts/DCTTemplates/CarrierProperty/MI/Carrier_Property_MI_00_39.xml'.
Added file 'ManuScripts/DCTTemplates/CarrierProperty/MI/Carrier_Property_MI_00_40.xml'.
Added file 'ManuScripts/DCTTemplates/CarrierProperty/MI/Carrier_Property_MI_00_41.xml'.
Added file 'ManuScripts/DCTTemplates/CarrierProperty/MI/Carrier_Property_MI_00_42.xml'.
Added file 'ManuScripts/DCTTemplates/CarrierProperty/MI/Carrier_Property_MI_00_43.xml'.
##[error]The nuget command failed with exit code(null) and error()
##[error]An error occurred while trying to pack the files.
Finishing: NuGetCommand
Full task logs with system.debug enabled
UNSUCCESSFUL RUN
[FailedBuild.log](https://github.com/user-attachments/files/16750944/FailedBuild.log)
SUCCESSFUL RUN
[SuccessfulBuild.log](https://github.com/user-attachments/files/16750948/SuccessfulBuild.log)
Repro steps
# unclear if it matters, but encountered this with a parameterized build
# ADO pipeline is hooked up to a YML file that extends a parameterized YML file with components like the below
# this is not a full YML file - just snips of our particular YML file that highlights the problem
parameters:
- name: buildtype
displayName: 'Build Type?'
type: string
default: ci
values:
- ci
- feature
- develop
- hotfix
- main
- upgrade
variables:
partialbuildnumber: $[ format('{0:yyyy}.{0:MM}.{0:dd}.{1}', pipeline.startTime,counter(format('{0:yyyyMMdd}', pipeline.startTime), 1))]
fullbuildnumber: "$(partialbuildnumber)-${{parameters.buildtype}}"
# instance of the problem happens to check out two separate repos
# one of the repos is checked out to a folder named "Policy"
- task: NuGetCommand@2.244.1
inputs:
command: 'pack'
packagesToPack: '$(Pipeline.Workspace)/**/Policy.nuspec'
versioningScheme: byEnvVar
versionEnvVar: fullbuildnumber
buildProperties: 'PolicyFolder=$(Pipeline.Workspace)\Policy'
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 30
- Comments: 97 (6 by maintainers)
Just now: our pipeline used version NuGet@2.245.3 and is failing once again.
Hey folks, apologies for the regression in behavior for the
NuGetCommandtask – we have finished a deployment that rolls back the latest version of the task to point to the previously working version of2.238.1(including classic YAML pipelines). Please feel free to let us know if you are still seeing issues when targeting the latest version of theNuGetCommandtask.Same
First observed failure for me was when after fetching 2.245.3 at 2024-09-09T09:07:43.9120785Z
Last observed success for me was after fetching 2.238.1 at 2024-09-09T08:46:47.0764253Z
Noticing that the project page currently shows v243 as the latest release.
https://github.com/microsoft/azure-pipelines-tasks
This raises some questions:
@cormacpayne - thanks for handling this relatively quickly 2 weeks ago. Can you offer any insights on why this task is getting so unstable?
To resolve the problem on my classic pipeline i change the “Verbosity” option to “Normal” on configuration of the task “NuGet”.
Seemingly ran into this same issue on Azure DevOps. Our CI builds started failing to restore nuget with this same error on v2.252.1. I believe they are self-hosted agents, and not sure how the update that caused this issue occurred.
Pinning to v2.238.1 seemed to fix the issue for us.
Weirdly not all of our agents were affected negatively by this. One of our four build agents seemingly had no issues and was able to pass while on v2.252.1 according to the log in devops.
I’m waiting for someone from Microsoft to chime on and state that they’ve rolled back 2.245.3.
Until Microsoft actually addresses this specific open issue, the current data set suggests to me that every new version of this task is going to include this same problem.
After a Microsoft dev reported that 2.244.1 was rolled back, I rolled back my own pipeline changes.
After 2.245.3 was published and revealed to include this same problem, I am sticking explicitly with 2.238.1 until this issue has been proven to be fixed. My teams simply cannot afford the disruption caused by this bug.
@cormacpayne our pipeline started to fail recently with this error. Has the issue been reintroduced?
I can confirm that the issue doesn’t appear anymore. When targeting the latest version of the
NuGetCommandit takes the2.238.1version by default.I’m having trouble finding how to specify this version, could you give a hint please?
Edit: simple as this:
- task: NuGetCommand@2.238.1We have the same problem with classic pipelines version 2.252.1. There is no way to define the version in “classic” pipelines.
Almost all my pipelines are failing… I appreciate an urgent fix.
We are also facing this issue with nuget restore, is there a way to to force the version to 2.238.1 when using classic pipeline ? We are also using private feeds, any script to run the nuget restore with private feeds using powershell ? Or any solution for this ?
Our pipeline breaks because of new version 2.245.3. Works fine with 2.238.1. Our pipeline script:
Error: Starting: Download NuGet packages
Task : NuGet Description : Restore, pack, or push NuGet packages, or run a NuGet command. Supports NuGet.org and authenticated feeds like Azure Artifacts and MyGet. Uses NuGet.exe and works with .NET Framework apps. For .NET Core and .NET Standard apps, use the .NET Core task. Version : 2.245.3 Author : Microsoft Corporation Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/package/nuget
… ##[error]The nuget command failed with exit code(null) and error() ##[debug]Processed: ##vso[task.issue type=error;]The nuget command failed with exit code(null) and error() ##[debug]task result: Failed ##[error]Packages failed to restore
Can you add regression test to catch this failure?
Same on our side. Pipeline just stopped working.
The new v2.253.0 version is currently being deployed, and has completed deployment to 3/5 of production instances across Azure DevOps. We estimate deployment will complete on Monday/Tuesday.
I can sync with the engineering owners of the overall libraries to see if we can publish a more concrete set of documentation regarding the release process, but generally for non-hotfix releases deployment (not this specific case) will be completed once every 3 weeks.
Hey folks, thanks for the information everyone, I was able to get a repro going and #20873 should resolve this issue in future releases which will begin rollout next week 😄
Same problem here! Blocks our releases as well, please prioritize!
We are also hitting the same problem with classic release pipelines using
2.252.1NuGet task version. Please make this a high priority item as this blocks all our releasesWe have the same problem with classic pipelines version 2.252.1. There is no way to define the version in “classic” pipelines.
Almost all my pipelines are failing… I appreciate an urgent fix.
Same here with 2.245.3 now being used and displaying the same issue.
Just to be correct here. They rolled back from 2.252 to 2.238 two weeks ago.
2.253 is the version which was released last week.
This is a great question. It isn’t clear what the release process is for the azure-pipelines-tasks repo, which makes it hard to plan around issues such as this.
I’ll take care of this as part of this issue, no need to re-report to Developer Community 😄
As an FYI, we are beginning to rollback the deployed version from 2.252 to 2.238.
As workaround you can use API to update the definition of the classic pipeline. Procedure is following:
This code could be used to export/import the definition:
It is using Microsoft.Identity.Client for authentication to Azure Devops API. Other way you could change it to use PAT token.
Today it’s getting the 2.238.1 version again and works.
We’re facing the same but with Self-Hosted pools based on ubuntu image. After forcing version 2.238.1 for nuget command step all has been working smoothly.
Thanks!
I’ve been wondering the same thing.
@cobya any chance you can link to some documentation that can let us know how these new task versions get rolled out, or how long we may need to wait before we see it? Thanks!
While I’m tempted to just revert our targeted use of 2.238.1, I’m hesitant to do so until I can confirm that 2.253.x resolves my problem.
I can see that the PR associated with this bug was merged on 2/21/2025, but have been unable to locate any documentation around the task deployment process.
The PR looks like it shows the new task version get set to 2.253.0. I’ve never seen a “.0.” version of a task, so I assume that the deployment flow will increment that to 2.253.1.
In any case, I’ve introduced a branch in my repo that explicitly targets NuGetCommand@2.253.0 and NuGetCommand@2.253.1 and have been periodically triggering a pipeline build against it (once a day or so). So far, my pipeline just blows up with a “task is missing” error…
Thanks @cobya - that sounds like a great start. I’m very happy we have someone actively looking into this.
@m-soltani FWIW i briefly tried to loot at the nuget PR that went into 2.252.1 and understand it and see if i can tell how verbosity makes a difference and i see nothing obvious. However, I made my github account literally yesterday morning and have no familiarity at all with the code base here so probably not a suprise. The PR is here: https://github.com/microsoft/azure-pipelines-tasks/pull/20818
Same here, breaking all pipelines for a key reporsitory meaning our team cannot commit or release any changes.
We are wondering if it relates to either Central Package Management or using mixed target frameworks. The pipelines that are broken for us affect a project that uses CPM and also includes a mix of .net standard, .net472 and .Net 8 projects. An older branch of the same pipeline and other projects do work with 2.52.1 but the don’t use central package management and don’t use a mix of legacy and modern .net versions (net472 and .net standard 2.0 only).
We are currently on the classic/ gui pipelines (i.e not YAML) and ablie to chose only Task 2.* or task 1.* so rolling back/specifying the specific nuget restore version as others have done is a little more work though sounds possible via tfx-cli.
We’re going to attempt the fixes for out classic pipeline outlined in https://jessehouwing.net/azure-pipelines-you-broke-our-pipeline/
Facing this issue internally as of Friday 14th February evening. Reverting to 2.238.1 fixes it, thanks @jano-kucera (https://github.com/microsoft/azure-pipelines-tasks/issues/20351#issuecomment-2311605712)!
All of our pipelines have been failing since yesterday. We don’t have the luxury of defining the version we want to use as we are in the world of classic pipelines. I am hoping Microsoft have a fix for this soon.
Some interesting details I discovered when comparing against the logs of our working pipeline. We use the NuGetToolInstaller task, but across the agents they seem to be resolving different versions from their cache. Likely from when they were first run. The failed agents were resolving NuGet version 6.3.1.1, while the agent that ran without issue resolved 6.8.0.131.
I’ll investigate if forcing the NuGetToolInstaller task to grab the latest version of NuGet resolves the issues for us.
Using the latest NuGet via the tool installer allowed us to unpin the version on the NuGetCommand task
This feels like the task should be updated to have a clearer message around the dependency requirement, support the dependency versions as listed by the documentation, or update the major version and/or documentation around this task to communicate around this issue clearer. This error message provides no useful information to the user.
This has broken maybe ~574~ 1 pipelines at my organisation and effectively ground the ~organisation~ project to a halt whilst we pin to 2.238.1.
Yesterday the latest @2 was 2.238.1 and today it’s 2.252.1. Pinning back to 2.238.1 is also working for us.
We are narrowing down our case. Either more edits will be made here, or
stehubhexwill post below with more specifics.We ran into this same issue as @tonyzahnle on Azure DevOps running on a self-hosted agent. Our CI builds started failing after Noon CT during the NuGet restore command on v2.252.1. Previous builds were using V2.238.1.
Pinning to v2.238.1, seemed to fix the issue for us as well for now.
If another data point is desired, we suffer from this bug even with this as our task:
@nbouteiller Thank you, this had fixed the issue 😃
This is happening for us too, hundreds of pipelines (combination of classic and yml) are now failing with no easy workaround.
I tried this but it didn’t change anything
@leomoty, thanks, sorry, must have missed the comment.
You can create a ps script test as it works for me:
For me, this happens restoring nugets in a solution that has .NET Framework 4.8 projects. I’m not seeing the error in pipelines that have no framework projects. Pinning the version to 2.238.1 works around the issue for those pipelines affected.
We are experiencing the same issue. Unfortunately it is on a classic pipeline where the task version can’t be amended, beyond a dropdown containing “2., 1. 0.*”. Currently we don’t have the capacity to rebuild this pipeline using YAML. Is there a fix for this underway?
Same here. The workaround to fix the task version to 2.238.1 is getting stuff running for now.
If I’m reading things correctly, release info implies that the latest release is v243: https://github.com/microsoft/azure-pipelines-tasks/releases
Did unstable builds that are still in development get published early?