chocolatey/choco · error · ApplicationException

It appears you are attempting to use options that may be onl

Error message

It appears you are attempting to use options that may be only available in licensed versions of Chocolatey ('{0}'). There may be ways in the open source edition to achieve what you are looking to do. Please remove the argument and consult the documentation.

What it means

Thrown by ChocolateyUpgradeCommand.Validate() when the open-source (non-licensed) edition of Chocolatey detects arguments starting with '-dir' or '-install' in the unparsed input. These arguments map to licensed-edition-only features (directory and install location override). The OSS edition detects this common mistake and directs the user to the documentation rather than silently ignoring the option.

Source

Thrown at src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs:297

                throw new ApplicationException("Package name is required. Please pass at least one package name to upgrade.");
            }

            if (configuration.ForceDependencies && !configuration.Force)
            {
                throw new ApplicationException("Force dependencies can only be used with force also turned on.");
            }

            if (!string.IsNullOrWhiteSpace(configuration.Input))
            {
                var unparsedOptionsAndPackages = configuration.Input.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries);
                if (!configuration.Information.IsLicensedVersion)
                {
                    foreach (var argument in unparsedOptionsAndPackages.OrEmpty())
                    {
                        var arg = argument.ToLowerSafe();
                        if (arg.StartsWith("-dir") || arg.StartsWith("--dir") || arg.StartsWith("-install") || arg.StartsWith("--install"))
                        {
                            throw new ApplicationException("It appears you are attempting to use options that may be only available in licensed versions of Chocolatey ('{0}'). There may be ways in the open source edition to achieve what you are looking to do. Please remove the argument and consult the documentation.".FormatWith(arg));
                        }
                    }
                }
            }

            if (!string.IsNullOrWhiteSpace(configuration.SourceCommand.Username) && string.IsNullOrWhiteSpace(configuration.SourceCommand.Password))
            {
                this.Log().Debug(ChocolateyLoggers.LogFileOnly, "Username '{0}' provided. Asking for password.".FormatWith(configuration.SourceCommand.Username));
                System.Console.Write("User name '{0}' provided. Password: ".FormatWith(configuration.SourceCommand.Username));
                configuration.SourceCommand.Password = InteractivePrompt.GetPassword(configuration.PromptForConfirmation);
            }
        }

        public override void HelpMessage(ChocolateyConfiguration configuration)
        {
            this.Log().Info(ChocolateyLoggers.Important, "Upgrade Command");
            this.Log().Info(@"
Upgrades a package or a list of packages. If you do not have a package

View on GitHub (pinned to 0d5abdd10c)

Solutions

  1. Remove the licensed-only argument (-dir/--dir/-install/--install) and consult documentation for OSS alternatives
  2. If the feature is required, upgrade to a licensed edition of Chocolatey (Chocolatey for Business)
  3. For install arguments, check if a supported OSS equivalent exists such as --install-arguments (without the licensed --directory prefix)

Example fix

// before (OSS edition)
choco upgrade mypackage --directory=C:\Custom

// after (OSS edition - remove licensed-only option)
choco upgrade mypackage

// or use licensed edition where the option is supported
Defensive patterns

Strategy: validation

Validate before calling

// Check for licensed-only arguments before invoking the command
var licensedOnlyPrefixes = new[] { "-dir", "--dir", "-install", "--install" };
var hasLicensedArgs = args.Any(a =>
{
    var lower = a.ToLowerInvariant();
    return licensedOnlyPrefixes.Any(p => lower.StartsWith(p));
});
if (hasLicensedArgs && !isLicensedVersion)
{
    Console.Error.WriteLine("Licensed-only arguments detected. Remove them or use a licensed edition.");
    return;
}

Type guard

public static bool UsesOnlyOssSupportedArgs(IEnumerable<string> args, bool isLicensed)
{
    if (isLicensed) return true;
    var licensedPrefixes = new[] { "-dir", "--dir", "-install", "--install" };
    return !args.Any(a => licensedPrefixes.Any(p => a.ToLowerInvariant().StartsWith(p)));
}

Try / catch

try
{
    upgradeCommand.Validate(configuration);
}
catch (ApplicationException ex) when (ex.Message.Contains("licensed versions"))
{
    logger.Error("The specified arguments require a Chocolatey license. Remove them or upgrade.");
}

Prevention

When it happens

Trigger: Running 'choco upgrade <pkg> --install-arguments=...' or '--directory=...' on the free/open-source edition where configuration.Information.IsLicensedVersion is false. Passing '-directory' or '-installlocation' type options. Any argument whose lowercase form starts with '-dir', '--dir', '-install', or '--install' triggers this check.

Common situations: User follows a tutorial written for Chocolatey for Business (C4B) without realizing the features are licensed-only. User migrates scripts from a licensed environment to an OSS one. User expects --directory to work like --install-directory on the community edition.

Related errors


AI-assisted analysis of chocolatey/choco@0d5abdd10c (2026-08-13). Data as JSON: /api/errors/c5b95c0042b7d14c. Report an issue: GitHub.