{"record":{"id":"6338bce332a01b62","repo":"balderdashy/sails","slug":"could-not-json-parse-the-provided-where-clause","errorCode":null,"errorMessage":"Could not JSON.parse() the provided `where` clause. Here is the raw error: ${e.stack}","messagePattern":"Could not JSON\\.parse\\(\\) the provided `where` clause\\. Here is the raw error: (.+?)","errorType":"exception","errorClass":"UsageError","httpStatus":null,"severity":"error","filePath":"lib/hooks/blueprints/actionUtil.js","lineNumber":234,"sourceCode":"    req.options.criteria = req.options.criteria || {};\n    req.options.criteria.blacklist = req.options.criteria.blacklist || ['limit', 'skip', 'sort', 'populate'];\n\n    // Validate blacklist to provide a more helpful error msg.\n    var blacklist = req.options.criteria && req.options.criteria.blacklist;\n    if (blacklist && !_.isArray(blacklist)) {\n      throw new Error('Invalid `req.options.criteria.blacklist`. Should be an array of strings (parameter names.)');\n    }\n\n    // Look for explicitly specified `where` parameter.\n    var where = req.allParams().where;\n\n    // If `where` parameter is a string, try to interpret it as JSON.\n    // (If it cannot be parsed, throw a UsageError.)\n    if (_.isString(where)) {\n      try {\n        where = JSON.parse(where);\n      } catch (e) {\n        throw flaverr({ name: 'UsageError' }, new Error('Could not JSON.parse() the provided `where` clause. Here is the raw error: '+e.stack));\n      }\n    }//>-•\n\n    // If `where` has not been specified, but other unbound parameter variables\n    // **ARE** specified, build the `where` option using them.\n    if (!where) {\n\n      // Prune params which aren't fit to be used as `where` criteria\n      // to build a proper where query\n      where = req.allParams();\n\n      // Omit built-in runtime config (like query modifiers)\n      where = _.omit(where, blacklist || ['limit', 'skip', 'sort']);\n\n      // Omit any params that have `undefined` on the RHS.\n      where = _.omit(where, function(p) {\n        if (_.isUndefined(p)) { return true; }\n      });","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/balderdashy/sails/blob/7b76422cc27823df033572bdda5c4910a68b697f/lib/hooks/blueprints/actionUtil.js#L216-L252","documentation":"Error \"Could not JSON.parse() the provided `where` clause. Here is the raw error: ${e.stack}\" thrown in balderdashy/sails.","triggerScenarios":"Thrown at lib/hooks/blueprints/actionUtil.js:234 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7b76422cc27823df033572bdda5c4910a68b697f","analyzedAt":"2026-09-01T04:01:57.104Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}