Kong/insomnia · error · Error
Vault can not be unset in script
Error message
Vault can not be unset in script
What it means
Hard guard on the Vault class's unset method: scripts are never allowed to remove vault entries, so any call to insomnia.vault.unset() throws immediately regardless of the enableVaultInScripts setting.
Solutions
- Remove the insomnia.vault.unset() call from the script
- Manage vault entries from the app UI instead
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at packages/insomnia-scripting-environment/src/objects/environments.ts:420 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/4adf603b5f8aff0a.
Report an issue: GitHub.
Appendix: source
Thrown at packages/insomnia-scripting-environment/src/objects/environments.ts:420
// throw error on get or set method call if enableVaultInScripts is false
get: (target, prop, receiver) => {
if (!enableVaultInScripts) {
throw new Error('Vault is disabled in script');
}
return Reflect.get(target, prop, receiver);
},
set: (target, prop, value, receiver) => {
if (!enableVaultInScripts) {
throw new Error('Vault is disabled in script');
}
return Reflect.set(target, prop, value, receiver);
},
});
}
/** @ignore */
unset = () => {
throw new Error('Vault can not be unset in script');
};
/** @ignore */
clear = () => {
throw new Error('Vault can not be cleared in script');
};
/** @ignore */
set = () => {
throw new Error('Vault can not be set in script');
};
}
View on GitHub (pinned to d9bb2b0142)