Kong/insomnia · error · Error

Invalid JSON: ${err.message}

Error message

Invalid JSON: ${err.message}

What it means

Error "Invalid JSON: ${err.message}" thrown in Kong/insomnia.

Source

Thrown at packages/insomnia/src/common/templating/local-template-tags.ts:716

          }
          try {
            body = await context.util.decode(bodyBuffer, charset);
          } catch (err) {
            console.warn('[response] Failed to decode body', err);
            body = utf8StringFromBytes(bodyBuffer);
          }

          if (sanitizedFilter.indexOf('$') === 0) {
            let bodyJSON;
            let results;

            try {
              // Using JSONBig instead of JSON.parse because JSON can contain numbers larger than those representable by
              // IEEE 754 and cause them to be rounded or transformed into scientific notation. Interpreting them as
              // strings in the context of this tag allows for predictable piping from response to request.
              bodyJSON = JSONBigStringParser.parse(body) as null | boolean | number | string | object | unknown[];
            } catch (err) {
              throw new Error(`Invalid JSON: ${err.message}`);
            }

            try {
              results = await JSONPath({ json: bodyJSON, path: sanitizedFilter });
              if (!Array.isArray(results)) {
                results = [results];
              }
            } catch {
              throw new Error(`Invalid JSONPath query: ${sanitizedFilter}`);
            }

            if (results.length === 0) {
              throw new Error(`Returned no results: ${sanitizedFilter}`);
            }

            if (results.length > 1) {
              return JSON.stringify(results);
            }

View on GitHub (pinned to d9bb2b0142)

When it happens

Trigger: Thrown at packages/insomnia/src/common/templating/local-template-tags.ts:716 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of Kong/insomnia@d9bb2b0142 (2026-08-26). Data as JSON: /api/errors/2e10785d945d3fb3. Report an issue: GitHub.