{"record":{"id":"32fe4f0d46153d0d","repo":"chocolatey/choco","slug":"unable-to-find-suitable-location-for-the-executabl","errorCode":null,"errorMessage":"Unable to find suitable location for the executable. Searched the following locations: '{0}'","messagePattern":"Unable to find suitable location for the executable\\. Searched the following locations: '(.+?)'","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"src/chocolatey/infrastructure.app/services/WindowsFeatureService.cs","lineNumber":187,"sourceCode":"        private void EnsureExecutablePathSet()\r\n        {\r\n            if (!string.IsNullOrWhiteSpace(_exePath))\r\n            {\r\n                return;\r\n            }\r\n\r\n            foreach (var location in _exeLocations)\r\n            {\r\n                if (_fileSystem.FileExists(location))\r\n                {\r\n                    _exePath = location;\r\n                    break;\r\n                }\r\n            }\r\n\r\n            if (string.IsNullOrWhiteSpace(_exePath))\r\n            {\r\n                throw new FileNotFoundException(\"Unable to find suitable location for the executable. Searched the following locations: '{0}'\".FormatWith(string.Join(\"; \", _exeLocations)));\r\n            }\r\n        }\r\n\r\n        public void ListDryRun(ChocolateyConfiguration config)\r\n        {\r\n            EnsureExecutablePathSet();\r\n            var args = BuildArguments(config, _listArguments);\r\n            this.Log().Info(\"Would have run '{0} {1}'\".FormatWith(_exePath.EscapeCurlyBraces(), args.EscapeCurlyBraces()));\r\n        }\r\n\r\n        public IEnumerable<PackageResult> List(ChocolateyConfiguration config)\r\n        {\r\n            EnsureExecutablePathSet();\r\n            var args = BuildArguments(config, _listArguments);\r\n            var packageResults = new List<PackageResult>();\r\n\r\n            Environment.ExitCode = _commandExecutor.Execute(\r\n                _exePath,\r","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/chocolatey/choco/blob/0d5abdd10cc177a141e69547cad6935b419b6c17/src/chocolatey/infrastructure.app/services/WindowsFeatureService.cs#L169-L205","documentation":"WindowsFeatureService.EnsureExecutablePathSet iterates a list of candidate executable locations (_exeLocations). If none exists on disk, _exePath stays blank and it throws FileNotFoundException listing every searched path joined by '; '.","triggerScenarios":"Initializing the Windows Features source when the underlying servicing executable (e.g. DISM) is not found at any configured _exeLocations path, so FileExists is false for all and _exePath remains empty.","commonSituations":"A stripped Windows edition/core SKU without the servicing tooling; a corrupted Windows component store; custom Windows images where the expected exe paths are missing or relocated.","solutions":["Run on a supported Windows edition that includes the servicing tooling (DISM)","Repair the Windows component store (DISM /Online /Cleanup-Image /RestoreHealth)","Verify the expected executable paths in _exeLocations actually exist","Use the alternative WindowsFeatures backend (e.g. the Get-WindowsOptionalFeatures PowerShell source) if available"],"exampleFix":"// before\n# DISM missing -> error\n// after\nDISM /Online /Cleanup-Image /RestoreHealth\nchoco list --source=windowsfeatures","handlingStrategy":"validation","validationCode":"var found = _exeLocations.Any(p => fileSystem.FileExists(p));\nif (!found) {\n    throw new FileNotFoundException($\"Windows features executable not found in: {string.Join(\"; \", _exeLocations)}\");\n}","typeGuard":null,"tryCatchPattern":"try { windowsFeatureService.List(config); }\ncatch (FileNotFoundException ex) when (ex.Message.Contains(\"suitable location for the executable\")) {\n    // repair component store (DISM /Online /Cleanup-Image /RestoreHealth) then retry\n    logger.Error(ex.Message);\n}","preventionTips":["Run on a Windows edition that ships the servicing tooling (DISM)","Repair the component store when executables are missing","Confirm the expected exe paths exist before initializing the source"],"tags":["windows-features","executable-not-found","platform"],"backgroundTag":null,"analyzedSha":"0d5abdd10cc177a141e69547cad6935b419b6c17","analyzedAt":"2026-08-13T18:33:03.301Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}