{"record":{"id":"d93b5cc35a8bcb2f","repo":"angular/angular-cli","slug":"running-hook-name-is-not-supported","errorCode":null,"errorMessage":"Running hook \"${name}\" is not supported.","messagePattern":"Running hook \"(.+?)\" is not supported\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/angular/ssr/src/hooks.ts","lineNumber":81,"sourceCode":"    name: Hook,\n    context: Parameters<HooksMapping[Hook]>[0],\n  ): Promise<Awaited<ReturnType<HooksMapping[Hook]>>> {\n    const hooks = this.store.get(name);\n    switch (name) {\n      case 'html:transform:pre': {\n        if (!hooks) {\n          return context.html as Awaited<ReturnType<HooksMapping[Hook]>>;\n        }\n\n        const ctx = { ...context };\n        for (const hook of hooks) {\n          ctx.html = await hook(ctx);\n        }\n\n        return ctx.html as Awaited<ReturnType<HooksMapping[Hook]>>;\n      }\n      default:\n        throw new Error(`Running hook \"${name}\" is not supported.`);\n    }\n  }\n\n  /**\n   * Registers a new hook function under the specified hook name.\n   * This function should be a function that takes an argument of type `T` and returns a `string` or `Promise<string>`.\n   *\n   * @template Hook - The type of the hook name. It should be one of the keys of `HooksMapping`.\n   * @param name - The name of the hook under which the function will be registered.\n   * @param handler - A function to be executed when the hook is triggered. The handler will be called with an argument\n   *                  that may be modified by the hook functions.\n   *\n   * @remarks\n   * - If there are existing handlers registered under the given hook name, the new handler will be added to the list.\n   * - If no handlers are registered under the given hook name, a new list will be created with the handler as its first element.\n   *\n   * @example\n   * ```typescript","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular/ssr/src/hooks.ts#L63-L99","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nawait hooks.run('head', ctx);\n// after\nawait hooks.run('html', ctx);","handlingStrategy":"validation","validationCode":"const supportedHooks = ['html'];\nif (!supportedHooks.includes(hookName)) {\n  throw new Error(`Hook \"${hookName}\" unsupported; use one of ${supportedHooks.join(', ')}`);\n}","typeGuard":"function isSupportedHook(name: string): name is 'html' {\n  return name === 'html';\n}","tryCatchPattern":"try {\n  await hooks.run(hookName as any, ctx);\n} catch (e) {\n  if (e instanceof Error && e.message.includes('is not supported')) {\n    console.error(`Hook \"${hookName}\" unsupported in this @angular/ssr version`);\n  }\n  throw e;\n}","preventionTips":["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"],"tags":["ssr","hooks","api"],"backgroundTag":"unsupported-hook-name","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}