{"record":{"id":"2e10785d945d3fb3","repo":"Kong/insomnia","slug":"invalid-json-err-message","errorCode":null,"errorMessage":"Invalid JSON: ${err.message}","messagePattern":"Invalid JSON: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/insomnia/src/common/templating/local-template-tags.ts","lineNumber":716,"sourceCode":"          }\n          try {\n            body = await context.util.decode(bodyBuffer, charset);\n          } catch (err) {\n            console.warn('[response] Failed to decode body', err);\n            body = utf8StringFromBytes(bodyBuffer);\n          }\n\n          if (sanitizedFilter.indexOf('$') === 0) {\n            let bodyJSON;\n            let results;\n\n            try {\n              // Using JSONBig instead of JSON.parse because JSON can contain numbers larger than those representable by\n              // IEEE 754 and cause them to be rounded or transformed into scientific notation. Interpreting them as\n              // strings in the context of this tag allows for predictable piping from response to request.\n              bodyJSON = JSONBigStringParser.parse(body) as null | boolean | number | string | object | unknown[];\n            } catch (err) {\n              throw new Error(`Invalid JSON: ${err.message}`);\n            }\n\n            try {\n              results = await JSONPath({ json: bodyJSON, path: sanitizedFilter });\n              if (!Array.isArray(results)) {\n                results = [results];\n              }\n            } catch {\n              throw new Error(`Invalid JSONPath query: ${sanitizedFilter}`);\n            }\n\n            if (results.length === 0) {\n              throw new Error(`Returned no results: ${sanitizedFilter}`);\n            }\n\n            if (results.length > 1) {\n              return JSON.stringify(results);\n            }","sourceCodeStart":698,"sourceCodeEnd":734,"githubUrl":"https://github.com/Kong/insomnia/blob/d9bb2b0142600f21309832daea3317942d285984/packages/insomnia/src/common/templating/local-template-tags.ts#L698-L734","documentation":"Template-tag runtime error for {% response 'body' '$...' %}: the response body (parsed with JSONBig to preserve big numbers) is not valid JSON, so the JSONPath filter cannot be applied. The underlying parser message is appended.","triggerScenarios":"Thrown at packages/insomnia/src/common/templating/local-template-tags.ts:716 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the response actually returns JSON (check Content-Type and raw body)","Fix the server response or point the tag at a JSON response","Remove the '$' JSONPath filter if you intended a plain body/header lookup"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d9bb2b0142600f21309832daea3317942d285984","analyzedAt":"2026-08-26T18:04:05.187Z","contentChangedAt":"2026-08-26T18:04:05.187Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}