Kong/insomnia · error · Error
unknown request body mode
Error message
unknown request body mode: ${updatedReqBody.mode} What it means
Default branch of the body-mode switch in mergeRequestBody: the scripted request body uses a mode outside the known set (empty, file, formdata, urlencoded, graphql), so it cannot be mapped to a mimeType.
Solutions
- Use a supported body mode when updating request bodies in scripts
- Check that updatedReqBody.mode is set and spelled correctly
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/insomnia-scripting-environment/src/objects/request.ts:644 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/4754ceab2b000cdf.
Report an issue: GitHub.
Appendix: source
Thrown at packages/insomnia-scripting-environment/src/objects/request.ts:644
// TODO: improve this by sniffing
mimeType = 'application/octet-stream';
break;
}
case 'formdata': {
// boundary should already be part of Content-Type header
mimeType = 'multipart/form-data';
break;
}
case 'urlencoded': {
mimeType = 'application/x-www-form-urlencoded';
break;
}
case 'graphql': {
mimeType = 'application/json';
break;
}
default: {
throw new Error(`unknown request body mode: ${updatedReqBody.mode}`);
}
}
}
if (originalReqBody.mimeType) {
mimeType = originalReqBody.mimeType;
}
try {
const textContent =
updatedReqBody?.raw !== undefined
? updatedReqBody?.raw
: updatedReqBody?.graphql
? JSON.stringify(updatedReqBody?.graphql)
: undefined;
return {
mimeType: mimeType,
text: textContent,View on GitHub (pinned to d9bb2b0142)