balderdashy/sails · warning

- ${filePath}

Error message

- ${filePath}

What it means

This warning line is one entry ('- <filePath>') of the per-file list printed after the controllers naming-convention warning. Each ignored 'garbage' file in api/controllers gets its own line so the developer can see exactly which files were skipped during loading.

Source

Thrown at lib/app/private/controller/load-action-modules.js:185

        // Otherwise give up on this file, it's GARBAGE.
        // No, no, it's probably a very nice file but it's
        // no controller as far as we're concerned.
        else {
          garbage.push(filePath);
        } // </ it is garbage>

      }); // </each(file from includeAll)>


      // Complain about garbage.
      if (garbage.length) {
        sails.log.warn('---------------------------------------------------------------------------');
        sails.log.warn('Files in the `controllers` directory may be traditional controllers or \n' +
                     'action files.  Traditional controllers are dictionaries of actions, with \n' +
                     'pascal-cased filenames ending in "Controller" (e.g. MyGreatController.js).\n' +
                     'Action files are kebab-cased (e.g. do-stuff.js) and contain a single action.\n'+
                     'The following file'+(garbage.length > 1 ? 's were' : ' was')+' ignored for not meeting those criteria:');
        _.each(garbage, function(filePath){sails.log.warn('- '+filePath);});
        sails.log.warn('----------------------------------------------------------------------------\n');
      }

      // (Shallow) merge stuff from sails.config.controllers.moduleDefinitions on top of any loaded files.
      // Note that the third argument (force) to `helpRegisterAction` is `true`, so there's no danger
      // of identity conflicts.  Actions defined in `moduleDefinitions` will override anything else.
      _.each(_.get(sails, 'config.controllers.moduleDefinitions') || {}, function(action, actionIdentity) {
        helpRegisterAction(sails, action, actionIdentity, true);
      });

    } catch (e) { return cb(e); }

    // Get a list of the action identities.
    var actionIdentities = _.keys(sails._actions);

    // Flag indicating that warnings were raised (for formatting purposes).
    var raisedWarnings = false;

View on GitHub (pinned to 7b76422cc2)

Solutions

  1. Rename the file printed on this line to the kebab-case action convention or the PascalCase Controller convention.
  2. Delete it if it is a leftover/backup file.
  3. Relocate genuine shared code out of api/controllers.

Example fix

// before (warning line)
- api/controllers/MyController.old.js
// after (rename or delete)
api/controllers/my-controller.js
Defensive patterns

Strategy: validation

Validate before calling

const bad = fs.readdirSync('api/controllers').filter(f => !/^(^[A-Z][A-Za-z0-9]*Controller|[a-z0-9]+(-[a-z0-9]+)*)\.js$/.test(f));
bad.forEach(f => console.warn(`Rename or remove api/controllers/${f}`));

Prevention

When it happens

Trigger: Iterates over the garbage array produced while loading api/controllers — one line per file that did not match the controller or action-file naming conventions.

Common situations: Same as the header warning: misnamed files in api/controllers such as underscored names, camelCase names, spaces, or stray non-conforming files.

Related errors


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