{"id":"aedaf4aefd38ff23","repo":"sequelize/sequelize","slug":"json-paths-are-not-supported-in-this-dialect-nam-aedaf4","errorCode":null,"errorMessage":"JSON Paths are not supported in ${this.dialect.name} without unquoting the JSON value.","messagePattern":"JSON Paths are not supported in (.+?) without unquoting the JSON value\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/mssql/src/query-generator-typescript.internal.ts","lineNumber":320,"sourceCode":"  createSavepointQuery(savepointName: string): string {\n    return `SAVE TRANSACTION ${this.quoteIdentifier(savepointName)}`;\n  }\n\n  rollbackSavepointQuery(savepointName: string): string {\n    return `ROLLBACK TRANSACTION ${this.quoteIdentifier(savepointName)}`;\n  }\n\n  generateTransactionId(): string {\n    return randomBytes(10).toString('hex');\n  }\n\n  jsonPathExtractionQuery(\n    sqlExpression: string,\n    path: ReadonlyArray<number | string>,\n    unquote: boolean,\n  ): string {\n    if (!unquote) {\n      throw new Error(\n        `JSON Paths are not supported in ${this.dialect.name} without unquoting the JSON value.`,\n      );\n    }\n\n    return `JSON_VALUE(${sqlExpression}, ${this.escape(buildJsonPath(path))})`;\n  }\n\n  formatUnquoteJson(arg: Expression, options?: EscapeOptions) {\n    return `JSON_VALUE(${this.escape(arg, options)})`;\n  }\n\n  versionQuery() {\n    // Uses string manipulation to convert the MS Maj.Min.Patch.Build to semver Maj.Min.Patch\n    return `DECLARE @ms_ver NVARCHAR(20);\nSET @ms_ver = REVERSE(CONVERT(NVARCHAR(20), SERVERPROPERTY('ProductVersion')));\nSELECT REVERSE(SUBSTRING(@ms_ver, CHARINDEX('.', @ms_ver)+1, 20)) AS 'version'`;\n  }\n","sourceCodeStart":302,"sourceCodeEnd":338,"githubUrl":"https://github.com/sequelize/sequelize/blob/7e1deec499d5afbb8d1877c2f4d545cead1214ec/packages/mssql/src/query-generator-typescript.internal.ts#L302-L338","documentation":"MSSQL's jsonPathExtractionQuery only supports reading JSON values via JSON_VALUE (which always returns an unquoted scalar). Sequelize cannot safely produce a quoted-path query in MSSQL, so when called with unquote=false it throws rather than generate SQL that would return a quoted JSON string fragment the caller does not expect.","triggerScenarios":"Using a JSON path operator/getter on a model attribute where the ORM internally calls jsonPathExtractionQuery with unquote=false — e.g. querying `Model.findAll({ where: { 'data.path': value } })` without unquoting, or a where on a nested JSON path that resolves to a string the caller compares as a scalar.","commonSituations":"Where-clauses on nested JSON properties on MSSQL; using the jsonPath feature ported from PostgreSQL/SQLite (which supports both modes) without adapting for MSSQL's JSON_VALUE-only model.","solutions":["Use a path/getter that unquotes (the default for scalar reads) so Sequelize uses JSON_VALUE.","If you need the raw quoted value, read the parent JSON column and navigate in JS rather than via a SQL path.","Update Sequelize/mssql to a version where the JSON-path API enforces unquote:true for MSSQL automatically."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// On MSSQL, force unquote for any JSON path read\nfunction mssqlJsonPath(path) {\n  // Always read scalar via JSON_VALUE (unquoted)\n  return jsonPathExtractionQuery(column, path, true);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat MSSQL JSON path reads as scalar-only (JSON_VALUE).","Do not port PostgreSQL/SQLite JSON-path queries to MSSQL without enabling unquote.","For full JSON nodes, read the column and parse in JS."],"tags":["mssql","json","json-path","query-generator"],"analyzedSha":"7e1deec499d5afbb8d1877c2f4d545cead1214ec","analyzedAt":"2026-08-03T18:58:44.549Z","schemaVersion":2}