{"record":{"id":"c84f0efd46e1be7d","repo":"davila7/claude-code-templates","slug":"unknown-language-template-language","errorCode":null,"errorMessage":"Unknown language template: ${language}","messagePattern":"Unknown language template: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli-tool/src/templates.js","lineNumber":146,"sourceCode":"  }));\n}\n\nfunction getFrameworksForLanguage(language) {\n  const config = TEMPLATES_CONFIG[language];\n  if (!config || !config.frameworks) return [];\n  \n  return Object.keys(config.frameworks).map(key => ({\n    value: key,\n    name: config.frameworks[key].name\n  }));\n}\n\nfunction getTemplateConfig(selections) {\n  const { language, framework, commands = [] } = selections;\n  const baseConfig = TEMPLATES_CONFIG[language];\n  \n  if (!baseConfig) {\n    throw new Error(`Unknown language template: ${language}`);\n  }\n  \n  let files = [...baseConfig.files];\n  \n  // Add framework-specific files\n  if (framework && framework !== 'none' && baseConfig.frameworks && baseConfig.frameworks[framework]) {\n    const frameworkConfig = baseConfig.frameworks[framework];\n    if (frameworkConfig.additionalFiles) {\n      files = files.concat(frameworkConfig.additionalFiles);\n    }\n  }\n  \n  // Handle command selection\n  let selectedCommands = [];\n  if (commands && commands.length > 0) {\n    const availableCommands = getCommandsForLanguageAndFramework(language, framework);\n    selectedCommands = availableCommands.filter(cmd => commands.includes(cmd.name));\n  }","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/davila7/claude-code-templates/blob/a0851ed10c7c60463dac8cfaaca124cf32d5804d/cli-tool/src/templates.js#L128-L164","documentation":"Thrown by getTemplateConfig() in cli-tool/src/templates.js when the 'language' key of the selections object has no entry in TEMPLATES_CONFIG. The template system only supports the languages registered in that config map; any other string (or undefined) is rejected before any files are generated.","triggerScenarios":"Calling getTemplateConfig({language: 'rust'}) when TEMPLATES_CONFIG only defines e.g. javascript/typescript/python; passing selections without a language (undefined); a typo or case mismatch ('JavaScript' vs 'javascript').","commonSituations":"User input from an interactive prompt or CLI flag containing an unsupported language; version drift where a template name was renamed but callers still pass the old key; scripting the API directly with a guessed language name.","solutions":["Log and inspect selections.language — fix typos and use exact lowercase keys as defined in TEMPLATES_CONFIG in cli-tool/src/templates.js","Add the missing language entry to TEMPLATES_CONFIG if it should be supported","Validate the language against Object.keys(TEMPLATES_CONFIG) before calling getTemplateConfig"],"exampleFix":"// before\nconst baseConfig = TEMPLATES_CONFIG[language];\nif (!baseConfig) {\n  throw new Error(`Unknown language template: ${language}`);\n}\n\n// after\nconst baseConfig = TEMPLATES_CONFIG[language];\nif (!baseConfig) {\n  const supported = Object.keys(TEMPLATES_CONFIG).join(', ');\n  throw new Error(`Unknown language template: ${language}. Supported: ${supported}`);\n}","handlingStrategy":"validation","validationCode":"const { TEMPLATES_CONFIG } = require('./templates');\nif (!Object.prototype.hasOwnProperty.call(TEMPLATES_CONFIG, language)) {\n  throw new Error(`Unsupported language '${language}'. Choose from: ${Object.keys(TEMPLATES_CONFIG).join(', ')}`);\n}\nconst cfg = getTemplateConfig({ language, framework, commands });","typeGuard":"function isSupportedLanguage(lang) {\n  return typeof lang === 'string' && Object.prototype.hasOwnProperty.call(TEMPLATES_CONFIG, lang);\n}","tryCatchPattern":"try {\n  const cfg = getTemplateConfig(selections);\n} catch (e) {\n  if (/Unknown language template/.test(e.message)) {\n    const supported = Object.keys(TEMPLATES_CONFIG).join(', ');\n    throw new Error(`${e.message}. Supported languages: ${supported}`);\n  }\n  throw e;\n}","preventionTips":["Always validate user-supplied language against Object.keys(TEMPLATES_CONFIG) before calling getTemplateConfig","Normalize input to lowercase/kebab-case before lookup","When adding languages, update both TEMPLATES_CONFIG and any prompt choice lists together"],"tags":["validation","templates","invalid-argument"],"backgroundTag":"invalid-argument-value","analyzedSha":"a0851ed10c7c60463dac8cfaaca124cf32d5804d","analyzedAt":"2026-08-28T14:11:56.058Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}