chocolatey/choco · error · ApplicationException
License is missing or invalid.
Error message
License is missing or invalid.
What it means
Thrown by GenericRunner.FailOnMissingOrInvalidLicenseIfFeatureSet when the configuration.Features.FailOnInvalidOrMissingLicense flag is enabled, the command is not 'feature'/'features', and config.Information.IsLicensedVersion is false. This feature flag makes Chocolatey fail hard (rather than silently degrade) when licensed functionality is expected but no valid license is present. The feature/'features' command is exempt so users can always manage features including this one.
Source
Thrown at src/chocolatey/infrastructure.app/runners/GenericRunner.cs:170
this.Log().Debug("Including sources from chocolatey.config file.");
}
}
}
public void FailOnMissingOrInvalidLicenseIfFeatureSet(ChocolateyConfiguration config)
{
if (!config.Features.FailOnInvalidOrMissingLicense ||
config.CommandName.TrimSafe().IsEqualTo("feature") ||
config.CommandName.TrimSafe().IsEqualTo("features")
)
{
return;
}
if (!config.Information.IsLicensedVersion)
{
throw new ApplicationException("License is missing or invalid.");
}
}
public void Run(ChocolateyConfiguration config, Container container, bool isConsole, Action<ICommand> parseArgs)
{
var tasks = container.GetAllInstances<ITask>();
foreach (var task in tasks)
{
task.Initialize();
}
FailOnMissingOrInvalidLicenseIfFeatureSet(config);
HttpsSecurity.Reset();
EventManager.Publish(new PreRunMessage(config));
try
{
var command = FindCommand(config, container, isConsole, parseArgs);
View on GitHub (pinned to 0d5abdd10c)
Solutions
- Install or renew a valid Chocolatey license file in the expected location
- If the license is not needed, disable the feature: 'choco feature disable --name=failOnInvalidOrMissingLicense'
- Use 'choco feature' command (which is exempt) to manage the setting regardless of license state
- Verify the license file path and format match what Chocolatey expects
Example fix
// before: feature is enabled, no license choco install mypackage // throws: License is missing or invalid. // after: disable the strict check (always works since 'feature' is exempt) choco feature disable --name=failOnInvalidOrMissingLicense choco install mypackage
Defensive patterns
Strategy: validation
Validate before calling
// Check license and feature flag before running
if (config.Features.FailOnInvalidOrMissingLicense &&
!config.Information.IsLicensedVersion &&
!config.CommandName.IsEqualTo("feature") &&
!config.CommandName.IsEqualTo("features"))
{
Console.Error.WriteLine("License required (failOnInvalidOrMissingLicense is enabled). " +
"Disable with: choco feature disable --name=failOnInvalidOrMissingLicense");
return;
} Type guard
public static bool CanRunWithoutLicense(ChocolateyConfiguration config)
{
if (!config.Features.FailOnInvalidOrMissingLicense) return true;
if (config.CommandName.TrimSafe().IsEqualTo("feature") ||
config.CommandName.TrimSafe().IsEqualTo("features")) return true;
return config.Information.IsLicensedVersion;
} Try / catch
try
{
runner.FailOnMissingOrInvalidLicenseIfFeatureSet(config);
}
catch (ApplicationException ex) when (ex.Message.Contains("License is missing"))
{
logger.Error("No valid license. Disable failOnInvalidOrMissingLicense or install a license.");
// 'choco feature disable --name=failOnInvalidOrMissingLicense' always works
} Prevention
- Ensure valid license files are deployed before enabling failOnInvalidOrMissingLicense
- Remember that 'choco feature' commands are exempt and can always manage the setting
- Monitor license expiration dates in enterprise environments
- Have a fallback plan to disable the feature if the license lapses unexpectedly
When it happens
Trigger: The 'failOnInvalidOrMissingLicense' feature is enabled and the user runs any command other than 'feature'/'features' without a valid Chocolatey license installed. The license file is missing, expired, or corrupted. The license check in Information.IsLicensedVersion returns false due to no license being loaded.
Common situations: Enterprise environment mandates licensed features but the license expired or wasn't deployed to this machine. User enabled the fail-on-license feature as a safety measure but then the license lapsed. Machine was provisioned without the license file. License was installed for a different Chocolatey edition.
Related errors
- Automatic package creation from installer files only availab
- It appears you are attempting to use options that may be onl
- Source '{0}' is unable to be parsed
- Custom unofficial builds are not allowed by default. To ov
- Unable to load licensed assembly.
AI-assisted analysis of chocolatey/choco@0d5abdd10c (2026-08-13).
Data as JSON: /api/errors/f4928917f2bc0e2e.
Report an issue: GitHub.