{"record":{"id":"780d4350a1f4da89","repo":"handlebars-lang/handlebars.js","slug":"arg-not-supported-with-multiple-decorators","errorCode":null,"errorMessage":"Arg not supported with multiple decorators","messagePattern":"Arg not supported with multiple decorators","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"lib/handlebars/base.js","lineNumber":73,"sourceCode":"    if (toString.call(name) === objectType) {\n      extend(this.partials, name);\n    } else {\n      if (typeof partial === 'undefined') {\n        throw new Exception(\n          `Attempting to register a partial called \"${name}\" as undefined`\n        );\n      }\n      this.partials[name] = partial;\n    }\n  },\n  unregisterPartial: function (name) {\n    delete this.partials[name];\n  },\n\n  registerDecorator: function (name, fn) {\n    if (toString.call(name) === objectType) {\n      if (fn) {\n        throw new Exception('Arg not supported with multiple decorators');\n      }\n      extend(this.decorators, name);\n    } else {\n      this.decorators[name] = fn;\n    }\n  },\n  unregisterDecorator: function (name) {\n    delete this.decorators[name];\n  },\n  /**\n   * Reset the memory of illegal property accesses that have already been logged.\n   * @deprecated should only be used in handlebars test-cases\n   */\n  resetLoggedPropertyAccesses() {\n    resetLoggedProperties();\n  },\n};\n","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/handlebars-lang/handlebars.js/blob/13a7a679910d2adbfe7f6fad61ce8f98426b0378/lib/handlebars/base.js#L55-L91","documentation":"Thrown by HandlebarsEnvironment.registerDecorator when a caller passes both a hash/object of decorator registrations (name is an object, so multiple decorators are being registered via extend) and a second function argument. The object form of registration accepts only the decorator map; supplying a fn alongside it is unsupported, so the environment rejects the call rather than silently ignoring the fn. Fix by either passing a single name/function pair or passing only the object without a second argument.","triggerScenarios":"Handlebars.registerDecorator({a: d1, b: d2}, extraFn) — object first arg with truthy second arg.","commonSituations":"Copy-paste from registerHelper single-name form; mixing bulk and single registration styles in one call.","solutions":["Drop the second argument when passing a decorators object.","For a single decorator, pass a string name first: registerDecorator('name', fn)."],"exampleFix":"// before\nHandlebars.registerDecorator({inline: myDecorator}, other);\n// after\nHandlebars.registerDecorator({inline: myDecorator});","handlingStrategy":"validation","validationCode":"function safeRegisterDecorators(hb, nameOrMap, fn) {\n  if (typeof nameOrMap === 'object' && nameOrMap !== null && fn) {\n    throw new TypeError('Do not pass a second arg when bulk-registering decorators');\n  }\n  hb.registerDecorator(nameOrMap, fn);\n}","typeGuard":"const isDecoratorMap = (v) => v !== null && typeof v === 'object' && !Array.isArray(v);","tryCatchPattern":null,"preventionTips":["Mirror the registerHelper signature rules: string+fn OR object only.","Keep decorator and helper registration code paths separate to avoid copy-paste mixing."],"tags":["decorators","api-misuse","argument-error"],"backgroundTag":"invalid-argument","analyzedSha":"13a7a679910d2adbfe7f6fad61ce8f98426b0378","analyzedAt":"2026-09-02T20:25:07.518Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}