{"record":{"id":"8f81ab5d3b1b12eb","repo":"angular/angular-cli","slug":"option-match-is-not-defined","errorCode":null,"errorMessage":"Option \"${match}\" is not defined.","messagePattern":"Option \"(.+?)\" is not defined\\.","errorType":"exception","errorClass":"OptionIsNotDefinedException","httpStatus":null,"severity":"error","filePath":"packages/angular_devkit/schematics/src/rules/template.ts","lineNumber":115,"sourceCode":"    let path = entry.path as string;\n    const content = entry.content;\n    const original = path;\n\n    let start = path.indexOf(is);\n    // + 1 to have at least a length 1 name. `____` is not valid.\n    let end = path.indexOf(ie, start + isL + 1);\n\n    while (start != -1 && end != -1) {\n      const match = path.substring(start + isL, end);\n      let replacement = data[match];\n\n      if (!options.pipeSeparator) {\n        if (typeof replacement == 'function') {\n          replacement = replacement.call(data, original);\n        }\n\n        if (replacement === undefined) {\n          throw new OptionIsNotDefinedException(match);\n        }\n      } else {\n        const [name, ...pipes] = match.split(options.pipeSeparator);\n        replacement = data[name];\n\n        if (typeof replacement == 'function') {\n          replacement = replacement.call(data, original);\n        }\n\n        if (replacement === undefined) {\n          throw new OptionIsNotDefinedException(name);\n        }\n\n        replacement = pipes.reduce((acc: string, pipe: string) => {\n          if (!pipe) {\n            return acc;\n          }\n          if (!(pipe in data)) {","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular_devkit/schematics/src/rules/template.ts#L97-L133","documentation":"In applyPathTemplate, when a path placeholder match (without pipe separator) resolves to undefined in the template options data, OptionIsNotDefinedException is thrown. Template Content/Substitution options must provide a value for every __name__-style placeholder.","triggerScenarios":"Path like '__name@dasherize__.ts' where options/`data` lacks a 'name' key, or a replacement function returns undefined for the original value.","commonSituations":"Template files using placeholders not supplied by applyTemplates({...}); renaming files where the data object key is misspelled ('filename' vs 'name'); chained replacements returning undefined.","solutions":["Supply the missing option: applyTemplates({ name, ... }) so every placeholder has a value.","Fix placeholder/key spelling mismatches between the template path and the options object.","Provide a default: applyTemplates({ name: options.name ?? 'default' })."],"exampleFix":"// before\nmergeWith(apply(source, [template({})]))\n// after\nmergeWith(apply(source, [template({ name: options.name })]))","handlingStrategy":"validation","validationCode":"const placeholders = [...path.matchAll(/__([^_]+)__/g)].map(m => m[1].split('@')[0]);\nconst missing = placeholders.filter(k => !(k in data));\nif (missing.length) throw new Error(`Missing template options: ${missing.join(', ')}`);","typeGuard":"function hasAllOptions(data: Record<string, unknown>, keys: string[]): data is Required<Record<string, unknown>> {\n  return keys.every(k => data[k] !== undefined);\n}","tryCatchPattern":"try {\n  return mergeWith(apply(source, [template(options)]));\n} catch (err) {\n  if (err instanceof OptionIsNotDefinedException) {\n    console.error('Add missing template option:', err.message);\n  }\n}","preventionTips":["List all placeholders used in template file names and pass each to applyTemplates.","Give defaults for optional values in the options object.","Scan template directories in CI for placeholders and cross-check against options keys."],"tags":["schematics","template","missing-option","path-template"],"backgroundTag":"missing-template-option","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}