{"record":{"id":"ed9c2f06d4541771","repo":"balderdashy/sails","slug":"e-invalid-hook-config","errorCode":"E_INVALID_HOOK_CONFIG","errorMessage":"Error defining hook: `config` is a reserved property and cannot be used as a custom hook method.","messagePattern":"Error defining hook: `config` is a reserved property and cannot be used as a custom hook method\\.","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/hooks/index.js","lineNumber":36,"sourceCode":"   * @api private\n   */\n\n  return function Hook(definition) {\n\n    // Flags to indicate whether or not this hook's `initialize` function is asynchronous (i.e. declared with `async`)\n    // and whether or not it has any parameters.\n    var hasAsyncInit;\n    var initSeemsToExpectParameters;\n\n    // A few sanity checks to make sure te provided definition does not contain any reserved properties.\n    if (!_.isObject(definition)) {\n      // This particular behavior can be made a bit less genteel in future versions (it is currently\n      // forgiving for backwards compatibility)\n      definition = definition || {};\n    }\n\n    if (_.isFunction(definition.config)) {\n      throw flaverr({ name: 'userError', code: 'E_INVALID_HOOK_CONFIG' }, new Error('Error defining hook: `config` is a reserved property and cannot be used as a custom hook method.'));\n    }\n    if (_.isFunction(definition.middleware)) {\n      throw flaverr({ name: 'userError', code: 'E_INVALID_HOOK_CONFIG' }, new Error('Error defining hook: `middleware` is a reserved property and cannot be used as a custom hook method.'));\n    }\n\n\n\n    /**\n     * Load the hook asynchronously\n     *\n     * @api private\n     */\n\n    this.load = function(cb) {\n\n      var self = this;\n\n      // TODO: refactor this: (no need for an inline function declaration)","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/balderdashy/sails/blob/7b76422cc27823df033572bdda5c4910a68b697f/lib/hooks/index.js#L18-L54","documentation":"Error \"Error defining hook: `config` is a reserved property and cannot be used as a custom hook method.\" thrown in balderdashy/sails.","triggerScenarios":"Thrown at lib/hooks/index.js:36 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7b76422cc27823df033572bdda5c4910a68b697f","analyzedAt":"2026-09-01T04:01:57.104Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}