balderdashy/sails · error

Failed to stringify specified JSON response body :: ' + util

Error message

Failed to stringify specified JSON response body :: ' + util.inspect(data) + '\nError:\n' + util.inspect(e)

What it means

Error "Failed to stringify specified JSON response body :: ' + util.inspect(data) + '\nError:\n' + util.inspect(e)" thrown in balderdashy/sails.

Source

Thrown at lib/router/res.js:269

      try {

        var toWrite;

        // If the data is already a string, don't stringify it.
        // (This allows for sending plain text, XML, etc.)
        if (_.isString(data)) {
          toWrite = data;
        }
        else {
          try {
            toWrite = JSON.stringify(data);
            if (!res.get('content-type')) {
              res.set('content-type', 'application/json');
            }
          }
          catch(e) {
            throw new Error(
              'Failed to stringify specified JSON response body :: ' + util.inspect(data) +
              '\nError:\n' + util.inspect(e)
            );
          }
          // if (process.env.NODE_ENV !== 'production') {
          //   toWrite = e.message;
          // }
        }//>-

        res.write(toWrite);

      } catch (e) {
        if (req._sails && req._sails.log && req._sails.log.error) {
          req._sails.log.error(e);
        }
        else {
          console.error(e);
        }

View on GitHub (pinned to 7b76422cc2)

When it happens

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