{"record":{"id":"3fd09a266653feda","repo":"angular/angular-cli","slug":"cannot-determine-project-or-target","errorCode":null,"errorMessage":"Cannot determine project or target.","messagePattern":"Cannot determine project or target\\.","errorType":"exception","errorClass":"CommandModuleError","httpStatus":null,"severity":"error","filePath":"packages/angular/cli/src/commands/run/cli.ts","lineNumber":81,"sourceCode":"      }, true)\n      .strict();\n\n    const target = this.makeTargetSpecifier();\n    if (!target) {\n      return localYargs;\n    }\n\n    const schemaOptions = await this.getArchitectTargetOptions(target);\n\n    return this.addSchemaOptionsToCommand(localYargs, schemaOptions);\n  }\n\n  async run(options: Options<RunCommandArgs> & OtherOptions): Promise<number> {\n    const target = this.makeTargetSpecifier(options);\n    const { target: _target, ...extraOptions } = options;\n\n    if (!target) {\n      throw new CommandModuleError('Cannot determine project or target.');\n    }\n\n    return this.runSingleTarget(target, extraOptions);\n  }\n\n  protected makeTargetSpecifier(options?: Options<RunCommandArgs>): Target | undefined {\n    const architectTarget = options?.target ?? this.context.args.positional[1];\n    if (!architectTarget) {\n      return undefined;\n    }\n\n    const [project = '', target = '', configuration] = architectTarget.split(':');\n\n    return {\n      project,\n      target,\n      configuration,\n    };","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular/cli/src/commands/run/cli.ts#L63-L99","documentation":"The run command's run() method throws this when makeTargetSpecifier returns undefined, meaning the provided options could not be resolved into a project:target target specifier. Neither a direct --target/--project combination nor positional args produced a runnable target.","triggerScenarios":"Running `ng run` (or `ng <builder>`) with no positional 'project:target' argument and no project/target options; running `ng <architect command>` in a context where no project and no default target can be resolved.","commonSituations":"`ng run` with no arguments; running an architect command outside a project directory in a multi-project repo; missing defaultProject in angular.json; typo making the positional arg unparseable.","solutions":["Provide an explicit target: `ng run my-project:build` or `ng build my-project`.","Check angular.json contains the referenced project/target.","Set \"defaultProject\" in angular.json or run from inside a project directory."],"exampleFix":"// before\nng run\n// after\nng run my-app:serve:development","handlingStrategy":"validation","validationCode":"const ng = require('./angular.json');\nconst hasTarget = options.target || (options.project && ng.projects[options.project]);\nif (!hasTarget) {\n  throw new Error('Provide an explicit project:target, e.g. ng run my-app:build');\n}","typeGuard":"function canResolveTarget(o: { target?: string; project?: string }): boolean {\n  return typeof o.target === 'string' || typeof o.project === 'string';\n}","tryCatchPattern":null,"preventionTips":["Always pass explicit project:target to `ng run`.","Run architect commands from a directory inside a project.","Set defaultProject in angular.json for single-project workspaces."],"tags":["angular","cli","command-line","invalid-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}