chocolatey/choco · error · ApplicationException

Feature '{0}' not found

Error message

Feature '{0}' not found

What it means

Thrown by ChocolateyConfigSettingsService.DisableFeature when the feature name in configuration.FeatureCommand.Name does not match any feature in ConfigFileSettings.Features (case-insensitive via IsEqualTo). After the null-check failure, the method cannot proceed to disable a feature that doesn't exist in the configuration. This is the validation gate before ValidateSupportedFeature and the actual disable logic.

Source

Thrown at src/chocolatey/infrastructure.app/services/ChocolateyConfigSettingsService.cs:332

        }

        public ConfigFileFeatureSetting GetFeatureValue(string featureName)
        {
            var feature = ConfigFileSettings.Features.FirstOrDefault(f => f.Name.IsEqualTo(featureName));
            if (feature == null)
            {
                return null;
            }

            return feature;
        }

        public void DisableFeature(ChocolateyConfiguration configuration)
        {
            var feature = ConfigFileSettings.Features.FirstOrDefault(p => p.Name.IsEqualTo(configuration.FeatureCommand.Name));
            if (feature == null)
            {
                throw new ApplicationException("Feature '{0}' not found".FormatWith(configuration.FeatureCommand.Name));
            }

            ValidateSupportedFeature(feature);

            if (feature.Enabled || !feature.SetExplicitly)
            {
                if (!feature.Enabled && !feature.SetExplicitly)
                {
                    this.Log().Info(() => "{0} was disabled by default. Explicitly setting value.".FormatWith(feature.Name));
                }
                feature.Enabled = false;
                feature.SetExplicitly = true;
                _xmlService.Serialize(ConfigFileSettings, ApplicationParameters.GlobalConfigFileLocation);
                this.Log().Warn(() => "Disabled {0}".FormatWith(feature.Name));
            }
            else
            {
                this.Log().Warn(NoChangeMessage);

View on GitHub (pinned to 0d5abdd10c)

Solutions

  1. Run 'choco feature list' to see all available feature names
  2. Use the exact feature name shown in the list
  3. If the feature was renamed, find the current equivalent in documentation
  4. If the config file is corrupted, consider restoring defaults

Example fix

// before
choco feature disable --name=checksums

// after (correct name)
choco feature disable --name=usePackageExitCodes
// discover names:
choco feature list
Defensive patterns

Strategy: validation

Validate before calling

// Validate feature name exists before disabling
var knownFeatures = configFileSettings.Features.Select(f => f.Name).ToList();
if (!knownFeatures.Any(f => f.Equals(featureName, StringComparison.OrdinalIgnoreCase)))
{
    Console.Error.WriteLine($"Feature '{featureName}' not found. Known: {string.Join(", ", knownFeatures)}");
    return;
}

Type guard

public static bool CanDisableFeature(ConfigFileSettings settings, string featureName)
{
    return settings.Features.Any(f => f.Name.Equals(featureName, StringComparison.OrdinalIgnoreCase));
}

Try / catch

try
{
    configService.DisableFeature(configuration);
}
catch (ApplicationException ex) when (ex.Message.Contains("Feature") && ex.Message.Contains("not found"))
{
    logger.Error($"Feature '{configuration.FeatureCommand.Name}' not found. Run 'choco feature list'.");
}

Prevention

When it happens

Trigger: Running 'choco feature disable --name=<unknown>'. The feature name is misspelled or doesn't exist in the config file. User tries to disable a feature that was removed in the current version. Config file was manually edited and the feature entry was deleted.

Common situations: Typo in feature name. User follows outdated documentation. Feature was renamed between Chocolatey versions. Config file corruption or manual deletion of feature entries. User confuses a config setting name with a feature name.

Related errors


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