balderdashy/sails · error

E_INVALID_HOOK_CONFIG

E_INVALID_HOOK_CONFIG

Error message

Error defining hook: `config` is a reserved property and cannot be used as a custom hook method.

What it means

Error "Error defining hook: `config` is a reserved property and cannot be used as a custom hook method." thrown in balderdashy/sails.

Source

Thrown at lib/hooks/index.js:36

   * @api private
   */

  return function Hook(definition) {

    // Flags to indicate whether or not this hook's `initialize` function is asynchronous (i.e. declared with `async`)
    // and whether or not it has any parameters.
    var hasAsyncInit;
    var initSeemsToExpectParameters;

    // A few sanity checks to make sure te provided definition does not contain any reserved properties.
    if (!_.isObject(definition)) {
      // This particular behavior can be made a bit less genteel in future versions (it is currently
      // forgiving for backwards compatibility)
      definition = definition || {};
    }

    if (_.isFunction(definition.config)) {
      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.'));
    }
    if (_.isFunction(definition.middleware)) {
      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.'));
    }



    /**
     * Load the hook asynchronously
     *
     * @api private
     */

    this.load = function(cb) {

      var self = this;

      // TODO: refactor this: (no need for an inline function declaration)

View on GitHub (pinned to 7b76422cc2)

When it happens

Trigger: Thrown at lib/hooks/index.js:36 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of balderdashy/sails@7b76422cc2 (2026-09-01). Data as JSON: /api/errors/ed9c2f06d4541771. Report an issue: GitHub.