Kong/insomnia · error · Error
failed to update body
Error message
failed to update body: ${e} What it means
Wrapper error from mergeRequestBody: updating the request body (mimeType detection, text/params/file extraction) threw an unexpected exception, which is re-thrown with this prefix and the original error appended. Points at malformed body configuration on the updated request.
Solutions
- Read the appended original error to identify the real cause
- Simplify the request body update (mode, params, text) in the script
- Verify body field types match the scripting API
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at packages/insomnia-scripting-environment/src/objects/request.ts:676 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/ed35ca80edec9ebe.
Report an issue: GitHub.
Appendix: source
Thrown at packages/insomnia-scripting-environment/src/objects/request.ts:676
: undefined;
return {
mimeType: mimeType,
text: textContent,
fileName: updatedReqBody?.file,
params: updatedReqBody?.urlencoded?.map((param: QueryParam) => {
return {
name: param.key,
value: param.value,
type: param.type,
fileName: param.fileName,
multiline: param.multiline,
disabled: param.disabled,
};
}, {}),
};
} catch (e) {
throw new Error(`failed to update body: ${e}`);
}
}
export function mergeRequests(originalReq: InsomniaRequest, updatedReq: Request): InsomniaRequest {
const queryParamObjects = updatedReq.url.query.map(
queryParam => ({
name: queryParam.key,
value: queryParam.value,
disabled: queryParam.disabled,
}),
{},
);
const updatedReqProperties: Partial<InsomniaRequest> = {
name: updatedReq.name,
url: updatedReq.url.toStringWithoutQuery(),
method: updatedReq.method,
body: mergeRequestBody(updatedReq.body, originalReq.body),
headers: updatedReq.headers.map(View on GitHub (pinned to d9bb2b0142)