Kong/insomnia · error · Error

Error parsing JSON response

Error message

Error parsing JSON response: ${error}

What it means

Error thrown from the json() accessor returned to plugins in sendRequestWithoutSideEffects: the stored response body is not parseable as JSON, so calling response.json() inside plugin code rejects with the parse error.

Solutions

  1. Check Content-Type and body before calling json(), or read response.body as text
  2. Fix the endpoint to return valid JSON if it is expected to
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at packages/insomnia/src/plugins/context/network.ts:113 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at packages/insomnia/src/plugins/context/network.ts:113

        }
        const bodyResult = await services.helpers.readCurlResponse({
          bodyPath: responseBodyPath,
          bodyCompression: patch.bodyCompression,
        });

        return {
          code: lastRedirect.code,
          reason: lastRedirect.reason,
          headers: lastRedirect.headers,
          responseTime: patch.elapsedTime,
          body: bodyResult.body,
          ok: lastRedirect.code >= 200 && lastRedirect.code < 300,
          status: lastRedirect.reason || RESPONSE_CODE_REASONS[lastRedirect.code] || 'Unknown',
          json: () => {
            try {
              return JSON.parse(bodyResult.body);
            } catch (error) {
              throw new Error(`Error parsing JSON response: ${error}`);
            }
          },
        };
      },
    },
  };
}

View on GitHub (pinned to d9bb2b0142)