balderdashy/sails · error

The 2-ary usage of `res.send()` is no longer supported in Ex

Error message

The 2-ary usage of `res.send()` is no longer supported in Express 4/Sails v1.  Please use `res.status(statusCode).send(body)` instead.

What it means

Error "The 2-ary usage of `res.send()` is no longer supported in Express 4/Sails v1. Please use `res.status(statusCode).send(body)` instead." thrown in balderdashy/sails.

Source

Thrown at lib/router/res.js:198

    // Get the status codes from the HTTP module
    var statusCodes = http.STATUS_CODES;

    // If this is a known code, use its name (e.g. "FORBIDDEN" or "OK").
    // Otherwise, just turn the number into a string.
    var body = statusCodes[statusCode] || String(statusCode);

    // Set the response status code.
    res.statusCode = statusCode;

    // Send the response.
    return res.send(body);
  };

  // res.send()
  res.send = res.send || function _sendShim (data, noLongerSupported) {
    if (!_.isUndefined(noLongerSupported)) {
      throw new Error('The 2-ary usage of `res.send()` is no longer supported in Express 4/Sails v1.  Please use `res.status(statusCode).send(body)` instead.');
    }

    // Don't allow users to respond/redirect more than once per request
    // FUTURE: prbly move this check to our `res.writeHead()` impl
    try {
      onlyAllowOneResponse(res);
    }
    catch (e) {
      if (req._sails && req._sails.log && req._sails.log.error) {
        req._sails.log.error(e);
        return;
      }
      console.error(e);
      return;
    }

    // Ensure charset is set
    res.charset = res.charset || 'utf-8';

View on GitHub (pinned to 7b76422cc2)

When it happens

Trigger: Thrown at lib/router/res.js:198 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/e229e299a3c581c4. Report an issue: GitHub.