{"record":{"id":"0e7e7cd3ad08fb7b","repo":"angular/angular-cli","slug":"configuration-error-found-withappshell-withou","errorCode":null,"errorMessage":"Configuration error: found 'withAppShell()' without 'withRoutes()' in the same call to 'provideServerRendering()'.The 'withAppShell()' function requires 'withRoutes()' to be used.","messagePattern":"Configuration error: found 'withAppShell\\(\\)' without 'withRoutes\\(\\)' in the same call to 'provideServerRendering\\(\\)'\\.The 'withAppShell\\(\\)' function requires 'withRoutes\\(\\)' to be used\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/angular/ssr/src/routes/route-config.ts","lineNumber":466,"sourceCode":"  } else {\n    features = args;\n  }\n\n  const providers: (Provider | EnvironmentProviders)[] = [\n    provideServerRenderingPlatformServer(options),\n  ];\n\n  let hasAppShell = false;\n  let hasServerRoutes = false;\n\n  for (const { ɵkind, ɵproviders } of features) {\n    hasAppShell ||= ɵkind === ServerRenderingFeatureKind.AppShell;\n    hasServerRoutes ||= ɵkind === ServerRenderingFeatureKind.ServerRoutes;\n    providers.push(...ɵproviders);\n  }\n\n  if (!hasServerRoutes && hasAppShell) {\n    throw new Error(\n      `Configuration error: found 'withAppShell()' without 'withRoutes()' in the same call to 'provideServerRendering()'.` +\n        `The 'withAppShell()' function requires 'withRoutes()' to be used.`,\n    );\n  }\n\n  return makeEnvironmentProviders(providers);\n}\n\n/**\n * Checks if the first element of args is a `ServerRenderingOptions` object.\n */\nfunction hasOptions(\n  args:\n    | ServerRenderingFeature<ServerRenderingFeatureKind>[]\n    | [ServerRenderingOptions, ...ServerRenderingFeature<ServerRenderingFeatureKind>[]],\n): args is [ServerRenderingOptions, ...ServerRenderingFeature<ServerRenderingFeatureKind>[]] {\n  const value = args[0];\n","sourceCodeStart":448,"sourceCodeEnd":484,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular/ssr/src/routes/route-config.ts#L448-L484","documentation":"`provideServerRendering()` validates its feature combination: `withAppShell()` requires the server routes feature (`withRoutes()`) to be present in the same call. Without `withRoutes()`, there is no route configuration for the app shell to attach to, so the configuration is rejected at provider-creation time rather than failing later at runtime.","triggerScenarios":"Calling `provideServerRendering(withAppShell(AppShellComponent))` without also passing `withRoutes([...])` in the same call, e.g. in `app.config.server.ts` after a migration that dropped the routes feature.","commonSituations":"Migrating from the old `AngularAppEngine`/`CommonEngine` setup to the new `provideServerRendering` API and forgetting `withRoutes`; copying a minimal SSR example that only used `withRoutes()` then adding an app shell; a codemod partial migration.","solutions":["Add `withRoutes(serverRoutes)` to the same `provideServerRendering()` call, typically before `withAppShell()`.","Define your server routes (`ServerRoute[]`) in `app.routes.server.ts` and pass them to `withRoutes()`.","If you don't need an app shell, remove `withAppShell()` and keep only `withRoutes()`.","Re-check the official `app.config.server.ts` example in the @angular/ssr docs for the correct feature order."],"exampleFix":"// before\nexport default provideServerRendering(withAppShell(AppShellComponent));\n// after\nexport default provideServerRendering(\n  withRoutes(serverRoutes),\n  withAppShell(AppShellComponent),\n);","handlingStrategy":"validation","validationCode":"// sanity check in app.config.server.ts\nconst features = [withRoutes(serverRoutes), withAppShell(AppShellComponent)];\nif (!features.some(f => /* routes feature present */ serverRoutes.length >= 0)) {\n  throw new Error('withAppShell() requires withRoutes()');\n}\nexport default provideServerRendering(...features);","typeGuard":"function hasRoutesFeature(features: { ɵkind: ServerRenderingFeatureKind }[]): boolean {\n  return features.some(f => f.ɵkind === ServerRenderingFeatureKind.ServerRoutes);\n}","tryCatchPattern":"try {\n  const providers = provideServerRendering(withAppShell(AppShellComponent));\n} catch (e) {\n  if (String(e?.message).includes(\"withAppShell()' without 'withRoutes()\")) {\n    console.error('Add withRoutes(serverRoutes) to provideServerRendering()');\n  } else throw e;\n}","preventionTips":["Always pair `withAppShell()` with `withRoutes()` in the same `provideServerRendering()` call.","Keep `app.config.server.ts` aligned with the current @angular/ssr docs when upgrading.","Run `ng build` (even dev) in CI so provider-configuration errors surface before deploy.","Prefer the official starter's `app.config.server.ts` as the template and modify minimally."],"tags":["angular","ssr","configuration","provide-server-rendering","app-shell"],"backgroundTag":"missing-required-feature-config","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}