angular/angular-cli · error · UnknownPipeException

Pipe "${pipe}" is not defined.

Error message

Pipe "${pipe}" is not defined.

What it means

After resolving a piped placeholder's base value, each pipe segment is looked up in the template data; a pipe name not present in data throws UnknownPipeException. Pipes are just functions provided via applyTemplates (e.g. dasherize, capitalize).

Source

Thrown at packages/angular_devkit/schematics/src/rules/template.ts:134

        }
      } 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);
      }

      path = path.substring(0, start) + replacement + path.substring(end + ieL);

      start = path.indexOf(options.interpolationStart);
      // See above.
      end = path.indexOf(options.interpolationEnd, start + isL + 1);
    }

View on GitHub (pinned to bb72145f9a)

Solutions

  1. Pass the pipe function into applyTemplates, e.g. applyTemplates({ dasherize: string.dasherize }).
  2. Fix the pipe name typo in the template path.
  3. Define and supply your custom pipe function in the options data.

Example fix

// before
applyTemplates({}) // pipe 'dasherize' undefined
// after
applyTemplates({ dasherize: (s: string) => strings.dasherize(s) })
Defensive patterns

Strategy: validation

Validate before calling

const pipes = [...path.matchAll(new RegExp(`[^${options.pipeSeparator}]+`, 'g'))];
const missing = pipes.map(p => p[0]).filter(p => typeof data[p] !== 'function');
if (missing.length) throw new Error(`Pipes not provided: ${missing.join(', ')}`);

Type guard

function hasPipe(data: Record<string, unknown>, pipe: string): data is Record<string, (v: string) => string> & Record<string, unknown> {
  return typeof data[pipe] === 'function';
}

Try / catch

try {
  return mergeWith(apply(source, [template(options)]));
} catch (err) {
  if (err instanceof UnknownPipeException) {
    console.error('Register pipe function in template options:', err.message);
  }
}

Prevention

When it happens

Trigger: Path '__name@dasherise__' (typo) or '__name@camelize__' where no 'camelize' function was passed into the template options.

Common situations: Misspelled pipe names in template file names; forgetting to import/pass utility functions into applyTemplates; custom pipes not added to the data object.

Related errors


AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30). Data as JSON: /api/errors/ffa54bb053c8b4e7. Report an issue: GitHub.