chocolatey/choco · error · ApplicationException
An error has occurred. This package version already exists o
Error message
An error has occurred. This package version already exists on the repository and cannot be modified.{0}Package versions that are approved, rejected, or exempted cannot be modified.{0}See https://docs.chocolatey.org/en-us/community-repository/moderation/ for more information What it means
Thrown by NugetPush when pushing to the Chocolatey community feed (ChocolateyCommunityFeedPushSource) and the underlying NuGet push operation throws InvalidOperationException or HttpRequestException whose message contains 'already exists and cannot be modified'. The community feed does not allow re-uploading or modifying package versions that have entered moderation (approved, rejected, or exempted). This is a feed policy enforcement, not a technical error.
Source
Thrown at src/chocolatey/infrastructure.app/nuget/NugetPush.cs:78
symbolSource: "",
Convert.ToInt32(timeout.TotalSeconds),
disableBuffering,
endpoint => config.PushCommand.Key,
getSymbolApiKey: null,
noServiceEndpoint,
skipDuplicate,
symbolPackageUpdateResource: null,
nugetLogger).GetAwaiter().GetResult();
}
catch (Exception ex) when (ex is InvalidOperationException || ex is HttpRequestException)
{
var message = ex.Message;
if (!string.IsNullOrWhiteSpace(message))
{
if (config.Sources == ApplicationParameters.ChocolateyCommunityFeedPushSource && message.Contains("already exists and cannot be modified"))
{
throw new ApplicationException("An error has occurred. This package version already exists on the repository and cannot be modified.{0}Package versions that are approved, rejected, or exempted cannot be modified.{0}See https://docs.chocolatey.org/en-us/community-repository/moderation/ for more information".FormatWith(Environment.NewLine), ex);
}
if (message.Contains("406") || message.Contains("409"))
{
// Let this fall through so the actual error message is shown when the exception is re-thrown
"chocolatey".Log().Error("An error has occurred. It's possible the package version already exists on the repository or a nuspec element is invalid. See error below...");
}
}
throw;
}
"chocolatey".Log().Info(ChocolateyLoggers.Important, () => "{0} was pushed successfully to {1}".FormatWith(nupkgFileName, config.Sources));
}
#pragma warning disable IDE0022, IDE1006
[Obsolete("This overload is deprecated and will be removed in v3.")]
public static void push_package(ChocolateyConfiguration config, string nupkgFilePath, ILogger nugetLogger, string nupkgFileName, IFileSystem filesystem)
View on GitHub (pinned to 0d5abdd10c)
Solutions
- Increment the package version in the .nuspec and push the new version
- If the version was rejected in moderation, fix the issues and push a new incremented version
- Check the moderation status at https://community.chocolatey.org/packages/<yourpackage> before pushing
- For internal/private feeds this error does not apply; ensure --source points to your private feed if that's the intent
Example fix
// before // nuspec has <version>1.0.0</version> which was already pushed and moderated choco push --source=https://push.chocolatey.org/ // after // bump version in nuspec to <version>1.0.1</version> // rebuild, then: choco push --source=https://push.chocolatey.org/
Defensive patterns
Strategy: try-catch
Validate before calling
// Check package version before pushing to avoid duplicate
var metadata = new ChocolateyPackageMetadata(nupkgPath);
var existingPackages = nugetListService.Search($"id:{metadata.Id}");
var versionExists = existingPackages.Any(p => p.Version == metadata.Version.ToString());
if (versionExists)
{
Console.Error.WriteLine($"Version {metadata.Version} already exists. Bump the version.");
return;
} Try / catch
try
{
NugetPush.Run(config, nupkgPath, nugetLogger, filesystem);
}
catch (ApplicationException ex) when (ex.Message.Contains("already exists"))
{
logger.Error("Package version already pushed and moderated. Increment the version number.");
// Suggest version bump
} Prevention
- Always increment the package version in the .nuspec before building and pushing
- In CI/CD, check if the version already exists on the feed before pushing
- Use semantic versioning to systematically bump versions
- Check moderation status at https://community.chocolatey.org/packages/<id> before re-pushing
- For private feeds, use --skip-duplicate if available to avoid hard failures on conflicts
When it happens
Trigger: Running 'choco push' for a package version that was already uploaded to the community feed and has been moderated. The exception chain originates from the NuGet PackageUpdateResource.Push call which returns an HTTP 409 Conflict from the server. The catch filter matches on the community feed push source URL and the specific error message fragment.
Common situations: Maintainer tries to push a fix to an existing version instead of bumping the version. CI/CD pipeline re-runs and attempts to push the same version. Package was rejected in moderation and maintainer tries to re-push the same version. Version number wasn't incremented before building and pushing.
Related errors
AI-assisted analysis of chocolatey/choco@0d5abdd10c (2026-08-13).
Data as JSON: /api/errors/0bf7e5ea6f8bd587.
Report an issue: GitHub.