{"record":{"id":"59d5566db2d65082","repo":"balderdashy/sails","slug":"could-not-json-parse-the-provided-where-clause-59d556","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/parse-blueprint-options.js","lineNumber":135,"sourceCode":"\n        var where = {};\n\n        // For `findOne`, set \"where\" to just look at the primary key.\n        if (blueprint === 'findOne') {\n          where[Model.primaryKey] = req.param('id');\n          return where;\n        }\n\n        // Look for explicitly specified `where` parameter.\n        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, ['limit', 'skip', 'sort', 'populate', 'select', 'omit']);\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":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/balderdashy/sails/blob/7b76422cc27823df033572bdda5c4910a68b697f/lib/hooks/blueprints/parse-blueprint-options.js#L117-L153","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/parse-blueprint-options.js:135 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"}