angular/angular-cli · error · Error
Running hook "${name}" is not supported.
Error message
Running hook "${name}" is not supported. What it means
The SSR hooks runner supports a fixed set of hook names (the HooksMapping, e.g. 'html'). Calling run() with a hook name not in the supported switch falls through to the default case and throws.
Source
Thrown at packages/angular/ssr/src/hooks.ts:81
name: Hook,
context: Parameters<HooksMapping[Hook]>[0],
): Promise<Awaited<ReturnType<HooksMapping[Hook]>>> {
const hooks = this.store.get(name);
switch (name) {
case 'html:transform:pre': {
if (!hooks) {
return context.html as Awaited<ReturnType<HooksMapping[Hook]>>;
}
const ctx = { ...context };
for (const hook of hooks) {
ctx.html = await hook(ctx);
}
return ctx.html as Awaited<ReturnType<HooksMapping[Hook]>>;
}
default:
throw new Error(`Running hook "${name}" is not supported.`);
}
}
/**
* Registers a new hook function under the specified hook name.
* This function should be a function that takes an argument of type `T` and returns a `string` or `Promise<string>`.
*
* @template Hook - The type of the hook name. It should be one of the keys of `HooksMapping`.
* @param name - The name of the hook under which the function will be registered.
* @param handler - A function to be executed when the hook is triggered. The handler will be called with an argument
* that may be modified by the hook functions.
*
* @remarks
* - If there are existing handlers registered under the given hook name, the new handler will be added to the list.
* - If no handlers are registered under the given hook name, a new list will be created with the handler as its first element.
*
* @example
* ```typescriptView on GitHub (pinned to bb72145f9a)
Solutions
- Use a supported hook name such as 'html' when registering and running hooks
- Check the HooksMapping type for the exact allowed keys in your installed @angular/ssr version
- Update or replace the plugin that uses an unsupported hook name
- Implement the transform as an HTML post-processing step if no matching hook exists
Example fix
// before
await hooks.run('head', ctx);
// after
await hooks.run('html', ctx); Defensive patterns
Strategy: validation
Validate before calling
const supportedHooks = ['html'];
if (!supportedHooks.includes(hookName)) {
throw new Error(`Hook "${hookName}" unsupported; use one of ${supportedHooks.join(', ')}`);
} Type guard
function isSupportedHook(name: string): name is 'html' {
return name === 'html';
} Try / catch
try {
await hooks.run(hookName as any, ctx);
} catch (e) {
if (e instanceof Error && e.message.includes('is not supported')) {
console.error(`Hook "${hookName}" unsupported in this @angular/ssr version`);
}
throw e;
} Prevention
- Type hook names with the HooksMapping type instead of strings
- Re-check hook APIs after upgrading @angular/ssr; plugins may lag versions
- Fall back to manual HTML post-processing for transforms without a hook
When it happens
Trigger: Registering/invoking a custom hook name via AngularAppEngine hooks API that is not one of the supported keys, e.g. run('head' as any, ctx) or a plugin using an obsolete hook name after an API change.
Common situations: Third-party SSR plugins written against older/newer hook names, typos in hook names, custom transforms expecting hooks for 'element'/'text' that are not exposed.
Related errors
- A module or bootstrap option must be provided.
- host value cannot be an array.
- Server asset '${path}' does not exist.
- Angular app manifest is not set. Please ensure you are using
- Angular app engine manifest is not set. Please ensure you ar
AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30).
Data as JSON: /api/errors/d93b5cc35a8bcb2f.
Report an issue: GitHub.