The situation:
NuGetCommand@2 builds suddenly fail with: The nuget command failed with exit code(null) and error(). Comparing builds, every failing job ran task version 2.244.1 while working jobs ran 2.238.1: a regression in the task version, not the project code.
What actually fixes it (verified in the thread):
Pin NuGetCommand@2 back to 2.238.1 as an immediate fix: builds go green again. The task team fixed the regression in 2.253.0, which became the new default; the reporter confirmed 2.253.0 works. Remove the pin once 2.253.0 is rolled out to your org.