{"record":{"id":"20a3685d13e58689","repo":"chocolatey/choco","slug":"feature-0-not-found","errorCode":null,"errorMessage":"Feature '{0}' not found","messagePattern":"Feature '(.+?)' not found","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"src/chocolatey/infrastructure.app/services/ChocolateyConfigSettingsService.cs","lineNumber":332,"sourceCode":"        }\r\n\r\n        public ConfigFileFeatureSetting GetFeatureValue(string featureName)\r\n        {\r\n            var feature = ConfigFileSettings.Features.FirstOrDefault(f => f.Name.IsEqualTo(featureName));\r\n            if (feature == null)\r\n            {\r\n                return null;\r\n            }\r\n\r\n            return feature;\r\n        }\r\n\r\n        public void DisableFeature(ChocolateyConfiguration configuration)\r\n        {\r\n            var feature = ConfigFileSettings.Features.FirstOrDefault(p => p.Name.IsEqualTo(configuration.FeatureCommand.Name));\r\n            if (feature == null)\r\n            {\r\n                throw new ApplicationException(\"Feature '{0}' not found\".FormatWith(configuration.FeatureCommand.Name));\r\n            }\r\n\r\n            ValidateSupportedFeature(feature);\r\n\r\n            if (feature.Enabled || !feature.SetExplicitly)\r\n            {\r\n                if (!feature.Enabled && !feature.SetExplicitly)\r\n                {\r\n                    this.Log().Info(() => \"{0} was disabled by default. Explicitly setting value.\".FormatWith(feature.Name));\r\n                }\r\n                feature.Enabled = false;\r\n                feature.SetExplicitly = true;\r\n                _xmlService.Serialize(ConfigFileSettings, ApplicationParameters.GlobalConfigFileLocation);\r\n                this.Log().Warn(() => \"Disabled {0}\".FormatWith(feature.Name));\r\n            }\r\n            else\r\n            {\r\n                this.Log().Warn(NoChangeMessage);\r","sourceCodeStart":314,"sourceCodeEnd":350,"githubUrl":"https://github.com/chocolatey/choco/blob/0d5abdd10cc177a141e69547cad6935b419b6c17/src/chocolatey/infrastructure.app/services/ChocolateyConfigSettingsService.cs#L314-L350","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run 'choco feature list' to see all available feature names","Use the exact feature name shown in the list","If the feature was renamed, find the current equivalent in documentation","If the config file is corrupted, consider restoring defaults"],"exampleFix":"// before\nchoco feature disable --name=checksums\n\n// after (correct name)\nchoco feature disable --name=usePackageExitCodes\n// discover names:\nchoco feature list","handlingStrategy":"validation","validationCode":"// Validate feature name exists before disabling\nvar knownFeatures = configFileSettings.Features.Select(f => f.Name).ToList();\nif (!knownFeatures.Any(f => f.Equals(featureName, StringComparison.OrdinalIgnoreCase)))\n{\n    Console.Error.WriteLine($\"Feature '{featureName}' not found. Known: {string.Join(\", \", knownFeatures)}\");\n    return;\n}","typeGuard":"public static bool CanDisableFeature(ConfigFileSettings settings, string featureName)\n{\n    return settings.Features.Any(f => f.Name.Equals(featureName, StringComparison.OrdinalIgnoreCase));\n}","tryCatchPattern":"try\n{\n    configService.DisableFeature(configuration);\n}\ncatch (ApplicationException ex) when (ex.Message.Contains(\"Feature\") && ex.Message.Contains(\"not found\"))\n{\n    logger.Error($\"Feature '{configuration.FeatureCommand.Name}' not found. Run 'choco feature list'.\");\n}","preventionTips":["Always run 'choco feature list' first to get exact feature names","Copy the name from the list output to avoid typos","Don't confuse feature names with config setting names","Keep the feature list accessible when writing scripts that toggle features"],"tags":["config","feature-management","not-found","command-args"],"backgroundTag":null,"analyzedSha":"0d5abdd10cc177a141e69547cad6935b419b6c17","analyzedAt":"2026-08-13T18:33:03.301Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}