{"record":{"id":"0c85e002663f81ba","repo":"chocolatey/choco","slug":"unable-to-find-requested-template-0","errorCode":null,"errorMessage":"Unable to find requested template '{0}'","messagePattern":"Unable to find requested template '(.+?)'","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"src/chocolatey/infrastructure.app/services/TemplateService.cs","lineNumber":293,"sourceCode":"            {\r\n                if (templateDirList.Contains(_fileSystem.CombinePaths(ApplicationParameters.TemplatesLocation.ToLowerInvariant(), configuration.TemplateCommand.Name.ToLowerInvariant())))\r\n                {\r\n                    ListCustomTemplateInformation(configuration);\r\n                    if (configuration.TemplateCommand.Name.IsEqualTo(_builtInTemplateName) || configuration.TemplateCommand.Name.IsEqualTo(_builtInTemplateOverrideName))\r\n                    {\r\n                        ListBuiltinTemplateInformation(configuration, isBuiltInTemplateOverridden, isBuiltInOrDefaultTemplateDefault);\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    if (configuration.TemplateCommand.Name.IsEqualTo(_builtInTemplateName) || configuration.TemplateCommand.Name.IsEqualTo(_builtInTemplateOverrideName))\r\n                    {\r\n                        // We know that the template is not overridden since the template directory was checked\r\n                        ListBuiltinTemplateInformation(configuration, isBuiltInTemplateOverridden, isBuiltInOrDefaultTemplateDefault);\r\n                    }\r\n                    else\r\n                    {\r\n                        throw new ApplicationException(\"Unable to find requested template '{0}'\".FormatWith(configuration.TemplateCommand.Name));\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        protected void ListCustomTemplateInformation(ChocolateyConfiguration configuration)\r\n        {\r\n            var sourceCacheContext = new ChocolateySourceCacheContext(configuration);\r\n            var packageResources = NugetCommon.GetRepositoryResources(configuration, _nugetLogger, _fileSystem, sourceCacheContext);\r\n            var pkg = NugetList.FindPackage(\r\n                    \"{0}.template\".FormatWith(configuration.TemplateCommand.Name),\r\n                    configuration,\r\n                    _nugetLogger,\r\n                    sourceCacheContext,\r\n                    packageResources);\r\n\r\n            var templateInstalledViaPackage = (pkg != null);\r\n\r","sourceCodeStart":275,"sourceCodeEnd":311,"githubUrl":"https://github.com/chocolatey/choco/blob/0d5abdd10cc177a141e69547cad6935b419b6c17/src/chocolatey/infrastructure.app/services/TemplateService.cs#L275-L311","documentation":"In the template info/list path, if the requested template name is neither the built-in name nor its override and the template directory was not found, TemplateService throws ApplicationException 'Unable to find requested template'. It only reaches this throw after the built-in/override branches are exhausted.","triggerScenarios":"Running the template info/list command (TemplateCommand.Name) for a name that is not the built-in template, not the override, and not present in the templates location.","commonSituations":"Querying info for a template that was never installed; a typo in the template name; listing before the template package is installed.","solutions":["Install the template package (choco install <name>.template)","Run choco template list to see which templates are actually available","Correct the template name spelling/case"],"exampleFix":"// before\nchoco template info nonexistent\n// after\nchoco install mytpl.template\nchoco template info mytpl","handlingStrategy":"validation","validationCode":"var dir = fileSystem.CombinePaths(ApplicationParameters.TemplatesLocation, config.TemplateCommand.Name);\nvar isBuiltIn = config.TemplateCommand.Name == _builtInTemplateName || config.TemplateCommand.Name == _builtInTemplateOverrideName;\nif (!isBuiltIn && !fileSystem.DirectoryExists(dir)) {\n    throw new DirectoryNotFoundException($\"Template '{config.TemplateCommand.Name}' not found. Run 'choco template list' to see available templates.\");\n}","typeGuard":null,"tryCatchPattern":"try { templateService.List(config); }\ncatch (ApplicationException ex) when (ex.Message.Contains(\"Unable to find requested template\")) {\n    logger.Error(ex.Message); // install template or correct name\n}","preventionTips":["Install the template package before querying its info","Run choco template list to confirm available template names","Check spelling and case of the template name"],"tags":["template","list","lookup"],"backgroundTag":null,"analyzedSha":"0d5abdd10cc177a141e69547cad6935b419b6c17","analyzedAt":"2026-08-13T18:33:03.301Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}