Kong/insomnia · error · InsoError
Failed to write to
Error message
Failed to write to "${outputPath}" What it means
InsoError thrown by writeFileWithCliOptions when mkdir or writeFile on the export target path rejects — the underlying Node fs error (permissions, invalid path, disk full) is logged and attached as the cause.
Solutions
- Check the console output for the underlying fs error
- Verify write permission on the output directory and that the path is valid
- Ensure the parent directory can be created (no read-only mount or missing parent permissions)
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at packages/insomnia-inso/src/commands/export-specification.ts:15 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/20b32fea4cf34a77.
Report an issue: GitHub.
Appendix: source
Thrown at packages/insomnia-inso/src/commands/export-specification.ts:15
import { mkdir, writeFile } from 'node:fs/promises';
import path from 'node:path';
import YAML from 'yaml';
import { InsoError } from '../errors';
export async function writeFileWithCliOptions(outputPath: string, contents: string): Promise<string> {
try {
await mkdir(path.dirname(outputPath), { recursive: true });
await writeFile(outputPath, contents);
return outputPath;
} catch (error) {
console.error(error);
throw new InsoError(`Failed to write to "${outputPath}"`, error);
}
}
export async function exportSpecification({
specContent,
skipAnnotations,
}: {
specContent: string;
skipAnnotations: boolean;
}) {
if (!skipAnnotations) {
return specContent;
}
const recursiveDeleteKey = (obj: any) => {
Object.keys(obj).forEach(key => {
if (key.startsWith('x-kong-')) {
delete obj[key];View on GitHub (pinned to d9bb2b0142)