Kong/insomnia · error · Error
the param for update must be: string |
Error message
the param for update must be: string | { key: string; value: string } What it means
Type guard at the end of QueryParam.update: the param argument is neither a string nor an object with 'key' and 'value' properties, so the update cannot be applied. The message enumerates the two accepted shapes.
Solutions
- Pass 'key=value' or { key, value }
- Check for null/undefined arguments in the script
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at packages/insomnia-scripting-environment/src/objects/urls.ts:122 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/f50f01a60cfa0c5b.
Report an issue: GitHub.
Appendix: source
Thrown at packages/insomnia-scripting-environment/src/objects/urls.ts:122
toRawString() {
return `${this.key}=${this.value}`;
}
update(param: string | { key: string; value: string; type?: string }) {
if (typeof param === 'string') {
const paramObj = QueryParam.parseSingle(param);
if (!paramObj) {
throw new Error('failed to update param: input `param` is invalid');
}
this.key = typeof paramObj.key === 'string' ? paramObj.key : '';
this.value = typeof paramObj.value === 'string' ? paramObj.value : '';
} else if ('key' in param && 'value' in param) {
this.key = param.key;
this.value = param.value;
this.type = param.type;
} else {
throw new Error('the param for update must be: string | { key: string; value: string }');
}
}
}
export interface UrlOptions {
id?: string;
auth?: {
username: string;
password: string;
};
hash?: string;
host: string[];
path?: string[];
port?: string;
protocol: string;
query: { key: string; value: string }[];
variables: { key: string; value: string }[];
}View on GitHub (pinned to d9bb2b0142)