angular/angular-cli · error · OptionIsNotDefinedException
Option " " is not defined.
Error message
Option "${name}" is not defined. What it means
Same family as error 246 but for piped placeholders: after splitting a match on options.pipeSeparator, the base name's value resolved to undefined in data, so OptionIsNotDefinedException(name) is thrown. Every piped placeholder's base name must exist in the template data.
Solutions
- Ensure the base key exists in applyTemplates data, e.g. applyTemplates({ name: options.name, dasherize: string.dasherize }).
- Fix the base placeholder name spelling in the template file path.
- Guard the value before applying: provide fallbacks in the options object.
Example fix
// before
applyTemplates({ dasherize }) // 'name' missing
// after
applyTemplates({ name: options.name, dasherize }) Defensive patterns
Strategy: validation
Validate before calling
const base = match.split(options.pipeSeparator!)[0];
if (!(base in data)) {
throw new Error(`Base option "${base}" must be provided to template()`);
} Type guard
function hasBaseOption(data: Record<string, unknown>, base: string): boolean {
return data[base] !== undefined;
} Try / catch
try {
return mergeWith(apply(source, [template(options)]));
} catch (err) {
if (err instanceof OptionIsNotDefinedException) {
console.error(`Provide base value for piped placeholder: ${err.message}`);
}
} Prevention
- For every __name@pipe__ placeholder, pass both the base key and the pipe function.
- Keep base names and pipe names distinct to avoid confusion.
- Review template file names whenever renaming options.
When it happens
Trigger: Path like '__name@dasherize__' with pipeSeparator '@' where data['name'] is undefined (or a function returning undefined before piping).
Common situations: Forgetting to pass the base option when only the piped form is used; typo in the base name inside a piped placeholder; applyTemplates called with the wrong options object.
Related errors
- Pipe " " is not defined.
- Option " " is not defined.
- Pipe " " is invalid.
- name option is required.
- Option "implements" is required.
AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30).
Data as JSON: /api/errors/a6f42ad49fb69230.
Report an issue: GitHub.
Appendix: source
Thrown at packages/angular_devkit/schematics/src/rules/template.ts:126
if (!options.pipeSeparator) {
if (typeof replacement == 'function') {
replacement = replacement.call(data, original);
}
if (replacement === undefined) {
throw new OptionIsNotDefinedException(match);
}
} else {
const [name, ...pipes] = match.split(options.pipeSeparator);
replacement = data[name];
if (typeof replacement == 'function') {
replacement = replacement.call(data, original);
}
if (replacement === undefined) {
throw new OptionIsNotDefinedException(name);
}
replacement = pipes.reduce((acc: string, pipe: string) => {
if (!pipe) {
return acc;
}
if (!(pipe in data)) {
throw new UnknownPipeException(pipe);
}
const pipeFn = data[pipe];
if (typeof pipeFn != 'function') {
throw new InvalidPipeException(pipe);
}
// Coerce to string.
return '' + pipeFn(acc);
}, '' + replacement);
}View on GitHub (pinned to bb72145f9a)