{"record":{"id":"7a0039a20c073445","repo":"angular/angular-cli","slug":"unrecognized-arguments","errorCode":null,"errorMessage":"Unrecognized arguments.","messagePattern":"Unrecognized arguments\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/angular_devkit/architect/src/jobs/simple-registry.ts","lineNumber":93,"sourceCode":"        // This is an error.\n        throw new TypeError('Expected a JobHandler as second argument.');\n      }\n\n      this._register(nameOrHandler, handlerOrOptions, options);\n    } else if (isJobHandler(nameOrHandler)) {\n      if (typeof handlerOrOptions !== 'object') {\n        // This is an error.\n        throw new TypeError('Expected an object options as second argument.');\n      }\n\n      const name = options.name || nameOrHandler.jobDescription.name || handlerOrOptions.name;\n      if (name === undefined) {\n        throw new TypeError('Expected name to be a string.');\n      }\n\n      this._register(name, nameOrHandler, options);\n    } else {\n      throw new TypeError('Unrecognized arguments.');\n    }\n  }\n\n  protected _register<\n    ArgumentT extends JsonValue,\n    InputT extends JsonValue,\n    OutputT extends JsonValue,\n  >(\n    name: JobName,\n    handler: JobHandler<ArgumentT, InputT, OutputT>,\n    options: RegisterJobOptions,\n  ): void {\n    if (this._jobNames.has(name)) {\n      // We shouldn't allow conflicts.\n      throw new JobNameAlreadyRegisteredException(name);\n    }\n\n    // Merge all fields with the ones in the handler (to make sure we respect the handler).","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular_devkit/architect/src/jobs/simple-registry.ts#L75-L111","documentation":"register() only recognizes two call shapes: register(name, handler, options?) and register(handler, options?). If the first argument is neither a string nor a valid JobHandler, the registry cannot interpret the call and throws 'Unrecognized arguments.' as a catch-all TypeError.","triggerScenarios":"Passing undefined/null/a Promise/a non-handler object as the first argument: register(undefined, handler), register(await createJobHandler(...)) without awaiting, register(null, ...).","commonSituations":"Forgetting to await an async handler factory so a Promise is passed; a variable that is undefined due to an import or initialization bug; passing an options object first by mistake.","solutions":["Inspect the first argument; ensure it is either a non-empty string name or an awaited JobHandler.","Await async handler creation before registering: registry.register(await createJobHandlerAsync(...)).","Fix undefined first arguments caused by bad imports/initialization order (check the variable is assigned before the call)."],"exampleFix":"// before\nregistry.register(createJobHandlerAsync(config), { name: 'my-job' });\n// after\nconst handler = await createJobHandlerAsync(config);\nregistry.register(handler, { name: 'my-job' });","handlingStrategy":"validation","validationCode":"const first = nameOrHandlerOrPromise;\nif (typeof first !== 'string' && !isJobHandler(first)) {\n  throw new Error(`first argument to register() must be a string name or JobHandler, got ${first === undefined ? 'undefined' : typeof first} (is it an un-awaited Promise?)`);\n}","typeGuard":"function isRegisterableFirstArg(v) {\n  return typeof v === 'string' || isJobHandler(v);\n}","tryCatchPattern":"try {\n  registry.register(nameOrHandler, ...rest);\n} catch (e) {\n  if (e instanceof TypeError && /Unrecognized arguments/.test(e.message)) {\n    throw new Error(`register() got invalid first argument (${typeof nameOrHandler}); check imports and await async factories`);\n  }\n  throw e;\n}","preventionTips":["Await any async handler factory before registering","Verify the variable is not undefined (check imports and initialization order)","Never pass null/undefined as the first argument","Cover registration calls with unit tests so an undefined argument fails early"],"tags":["typescript","typeerror","architect","job-registry","unrecognized-arguments"],"backgroundTag":"invalid-argument-type","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}