chocolatey/choco · error · ApplicationException
Automatic package creation from installer files only availab
Error message
Automatic package creation from installer files only available in Business edition. See https://chocolatey.org/compare for details.
What it means
Thrown by ChocolateyNewCommand.Validate when the user passes a package name that starts with '-file' or '--file'. This triggers the automatic package creation from installer files feature, which is licensed only for Chocolatey Business edition. The open-source/free build refuses it and points the user to the comparison page. The check is a naive string-prefix match on configuration.NewCommand.Name, so any name beginning with those flags is rejected.
Source
Thrown at src/chocolatey/infrastructure.app/commands/ChocolateyNewCommand.cs:114
}
else
{
configuration.NewCommand.TemplateProperties.Add(propName, propValue);
}
}
}
}
public virtual void Validate(ChocolateyConfiguration configuration)
{
if (string.IsNullOrWhiteSpace(configuration.NewCommand.Name))
{
throw new ApplicationException("Name is required. Please pass in a name for the new package.");
}
if (configuration.NewCommand.Name.StartsWith("-file", StringComparison.OrdinalIgnoreCase) || configuration.NewCommand.Name.StartsWith("--file", StringComparison.OrdinalIgnoreCase))
{
throw new ApplicationException(@"Automatic package creation from installer files only available in Business
edition. See https://chocolatey.org/compare for details.");
}
}
public virtual void HelpMessage(ChocolateyConfiguration configuration)
{
this.Log().Info(ChocolateyLoggers.Important, "New Command");
this.Log().Info(@"
Chocolatey will generate package specification files for a new package.
");
"chocolatey".Log().Info(ChocolateyLoggers.Important, "Usage");
"chocolatey".Log().Info(@"
choco new <name> [<options/switches>] [<property=value> <propertyN=valueN>]
Possible properties to pass:
packageversion
maintainername
View on GitHub (pinned to 0d5abdd10c)
Solutions
- If you need automatic package creation from installer files, obtain a Chocolatey Business license and install the licensed extension.
- If you do not have a Business license, create the package skeleton manually with 'choco new <pkgname>' (without --file) and fill in the install logic yourself.
- Ensure the package name does not accidentally begin with '-file' or '--file' due to argument mis-ordering.
Example fix
// before choco new mypkg --file="installer.exe" // after (FOSS edition — manual skeleton) choco new mypkg // then edit tools/chocolateyInstall.ps1 to invoke installer.exe
Defensive patterns
Strategy: validation
Validate before calling
// Before calling choco new, verify you are not triggering the --file path
// unless you have a Business license
if (!hasBusinessLicense && (packageName.StartsWith("--file", StringComparison.OrdinalIgnoreCase) || packageName.StartsWith("-file", StringComparison.OrdinalIgnoreCase)))
{
Console.Error.WriteLine("Automatic package creation from installers requires Business edition.");
return;
} Type guard
static bool CanAutoGenerateFromInstaller(bool hasBusinessLicense) => hasBusinessLicense;
Prevention
- Do not pass --file/-file to 'choco new' unless running Chocolatey Business edition.
- Use 'choco new <name>' for the free edition and write install scripts manually.
When it happens
Trigger: Running 'choco new <pkg> --file=<installer>' or 'choco new <pkg> -file=<installer>' in the free/open-source edition of Chocolatey. Also triggered if a package name literally begins with the strings '-file' or '--file' for any reason.
Common situations: A developer on Chocolatey FOSS edition tries to auto-generate a .nuspec/spec from an existing .exe/.msi installer and passes --file. The free edition does not include the Package Internalizer / automatic package generator; that is a Business (licensed) feature.
Related errors
- A single pin command must be listed. Please see the help men
- When specifying the subcommand '{0}', you must also specify
- Unable to find package named '{0}'{1} to pin. Please check t
- The default push source configuration is not set. Either pas
- Multiple sources are not supported by push command.
AI-assisted analysis of chocolatey/choco@0d5abdd10c (2026-08-13).
Data as JSON: /api/errors/a6fb632a4f0b48b7.
Report an issue: GitHub.