balderdashy/sails · error
E_BAD_GLOBAL_CONFIG
E_BAD_GLOBAL_CONFIG
Error message
As of Sails v1, if `sails.config.globals` is defined, it must either be `false` or a dictionary (plain JavaScript object) or `false`. But instead, got: '+util.inspect(sails.config.globals, {depth:null})+'\n> Note: if no globals are desired, set `sails.config.globals` to `false`. What it means
Error "As of Sails v1, if `sails.config.globals` is defined, it must either be `false` or a dictionary (plain JavaScript object) or `false`. But instead, got: '+util.inspect(sails.config.globals, {depth:null})+'\n> Note: if no globals are desired, set `sails.config.globals` to `false`." thrown in balderdashy/sails.
Source
Thrown at lib/app/private/exposeGlobals.js:39
module.exports = function exposeGlobals() {
var sails = this;
// Implicit default for globals is `false`, to allow for intuitive programmatic
// usage of `sails.lift()`/`sails.load()` in automated tests, command-line scripts,
// scheduled jobs, etc.
//
// > Note that this is not the same as the boilerplate `config/globals.js` settings,
// > since the use of certain global variables is still the recommended approach for
// > the code you write in your Sails app's controller actions, etc.
if (_.isUndefined(sails.config.globals)) {
sails.config.globals = false;
return;
}
// If globals config is provided, it must be either `false` or a dictionary.
else if (sails.config.globals !== false && (!_.isObject(sails.config.globals) || _.isArray(sails.config.globals) || _.isFunction(sails.config.globals))) {
throw flaverr({ name: 'userError', code: 'E_BAD_GLOBAL_CONFIG' }, new Error('As of Sails v1, if `sails.config.globals` is defined, it must either be `false` or a dictionary (plain JavaScript object) or `false`. But instead, got: '+util.inspect(sails.config.globals, {depth:null})+'\n> Note: if no globals config is specified, Sails will now assume `false` (no globals). This is to allow for more intuitive programmatic usage.\nFor more info, see http://sailsjs.com/config/globals'));
}
// Globals explicitly disabled.
if (sails.config.globals === false) {
sails.log.verbose('No global variables will be exposed.');
return;
}
sails.log.verbose('Exposing global variables... (you can customize/disable this by modifying the properties in `sails.config.globals`. Set it to `false` to disable all globals.)');
// `sails.config.globals._` must be false or an object.
// (it's probably a function with lots of extra properties, but to future-proof, we'll allow any type of object)
if (sails.config.globals._ !== false) {
if (!_.isObject(sails.config.globals._)) {
throw flaverr({ name: 'userError', code: 'E_BAD_GLOBAL_CONFIG' }, new Error('As of Sails v1, `sails.config.globals._` must be either `false` or a locally-installed version of Lodash (typically `require(\'lodash\')`). For more info, see http://sailsjs.com/config/globals'));
}
global['_'] = sails.config.globals._;
}View on GitHub (pinned to 7b76422cc2)
When it happens
Trigger: Thrown at lib/app/private/exposeGlobals.js:39 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/3bdf357c3e622407.
Report an issue: GitHub.