{"record":{"id":"513a8209bf4f25fd","repo":"angular/angular-cli","slug":"cannot-find-options-for-projectname-target","errorCode":null,"errorMessage":"Cannot find 'options' for ${projectName} ${target} target.","messagePattern":"Cannot find 'options' for (.+?) (.+?) target\\.","errorType":"exception","errorClass":"SchematicsException","httpStatus":null,"severity":"error","filePath":"packages/schematics/angular/ssr/index.ts","lineNumber":60,"sourceCode":"import { Schema as SSROptions } from './schema';\n\nconst SERVE_SSR_TARGET_NAME = 'serve-ssr';\nconst PRERENDER_TARGET_NAME = 'prerender';\nconst DEFAULT_BROWSER_DIR = 'browser';\nconst DEFAULT_MEDIA_DIR = 'media';\nconst DEFAULT_SERVER_DIR = 'server';\n\nasync function getLegacyOutputPaths(\n  host: Tree,\n  projectName: string,\n  target: 'server' | 'build',\n): Promise<string> {\n  // Generate new output paths\n  const workspace = await readWorkspace(host);\n  const project = workspace.projects.get(projectName);\n  const architectTarget = project?.targets.get(target);\n  if (!architectTarget?.options) {\n    throw new SchematicsException(`Cannot find 'options' for ${projectName} ${target} target.`);\n  }\n\n  const { outputPath } = architectTarget.options;\n  if (typeof outputPath !== 'string') {\n    throw new SchematicsException(\n      `outputPath for ${projectName} ${target} target is not a string.`,\n    );\n  }\n\n  return outputPath;\n}\n\nasync function getApplicationBuilderOutputPaths(\n  host: Tree,\n  projectName: string,\n): Promise<{ browser: string; server: string; base: string }> {\n  // Generate new output paths\n  const target = 'build';","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/schematics/angular/ssr/index.ts#L42-L78","documentation":"The Angular SSR schematic needs to read the `outputPath` from the project's build target options to rewire output paths. This error is thrown when the target exists in angular.json but has no `options` object at all, so the schematic cannot locate any output configuration.","triggerScenarios":"Running the `ng add @angular/ssr` (or ssr schematic) on a workspace where `angular.json` defines the project's `build` (or specified) target without an `options` section — e.g. the target only has `configurations`, or options were manually removed.","commonSituations":"Hand-edited angular.json that stripped `options`; workspaces generated by non-CLI tools; custom builders whose options live only under a configuration; partial/corrupt angular.json after a migration.","solutions":["Open angular.json and add an `options` object with at least an `outputPath` (string) to the project's `build` target.","Regenerate angular.json from a fresh `ng new` project and re-apply your customizations.","Verify the project/target names passed to the schematic match entries in angular.json (`ng config projects.<name>.architect.build.options`).","Regenerate the workspace config with `ng generate config` or restore it from version control."],"exampleFix":"// before (angular.json)\n\"build\": { \"configurations\": { \"production\": {} } }\n// after\n\"build\": {\n  \"options\": { \"outputPath\": \"dist/my-app\" },\n  \"configurations\": { \"production\": {} }\n}","handlingStrategy":"validation","validationCode":"const project = (await readWorkspace(host)).projects.get(projectName);\nconst target = project?.targets.get('build');\nif (!target?.options) {\n  throw new Error(`Project ${projectName} build target has no options; add outputPath to angular.json before running the SSR schematic.`);\n}\nif (typeof target.options.outputPath !== 'string') {\n  throw new Error(`outputPath of ${projectName} build target is not a string.`);\n}","typeGuard":"function hasTargetOptions(t: { options?: Record<string, unknown> } | undefined): t is { options: Record<string, unknown> } {\n  return !!t && typeof t.options === 'object' && t.options !== null;\n}","tryCatchPattern":"try {\n  await schematicPromise;\n} catch (e) {\n  if (e instanceof SchematicsException && e.message.includes(\"Cannot find 'options'\")) {\n    console.error('Fix angular.json: add options.outputPath to the build target.');\n  }\n  throw e;\n}","preventionTips":["Always keep an `options` object with a string `outputPath` on the build target in angular.json.","Run `ng build` successfully before adding SSR — it validates the workspace config.","Avoid hand-editing angular.json; use `ng config` commands.","Version-control angular.json so accidental deletions are recoverable."],"tags":["angular","schematics","ssr","angular-json","configuration"],"backgroundTag":"missing-target-options-in-angular-json","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}