{"record":{"id":"20b32fea4cf34a77","repo":"Kong/insomnia","slug":"failed-to-write-to-outputpath","errorCode":null,"errorMessage":"Failed to write to \"${outputPath}\"","messagePattern":"Failed to write to \"(.+?)\"","errorType":"exception","errorClass":"InsoError","httpStatus":null,"severity":"error","filePath":"packages/insomnia-inso/src/commands/export-specification.ts","lineNumber":15,"sourceCode":"import { mkdir, writeFile } from 'node:fs/promises';\nimport path from 'node:path';\n\nimport YAML from 'yaml';\n\nimport { InsoError } from '../errors';\n\nexport async function writeFileWithCliOptions(outputPath: string, contents: string): Promise<string> {\n  try {\n    await mkdir(path.dirname(outputPath), { recursive: true });\n    await writeFile(outputPath, contents);\n    return outputPath;\n  } catch (error) {\n    console.error(error);\n    throw new InsoError(`Failed to write to \"${outputPath}\"`, error);\n  }\n}\n\nexport async function exportSpecification({\n  specContent,\n  skipAnnotations,\n}: {\n  specContent: string;\n  skipAnnotations: boolean;\n}) {\n  if (!skipAnnotations) {\n    return specContent;\n  }\n\n  const recursiveDeleteKey = (obj: any) => {\n    Object.keys(obj).forEach(key => {\n      if (key.startsWith('x-kong-')) {\n        delete obj[key];","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/Kong/insomnia/blob/d9bb2b0142600f21309832daea3317942d285984/packages/insomnia-inso/src/commands/export-specification.ts#L1-L33","documentation":"Error \"Failed to write to \"${outputPath}\"\" thrown in Kong/insomnia.","triggerScenarios":"Thrown at packages/insomnia-inso/src/commands/export-specification.ts:15 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d9bb2b0142600f21309832daea3317942d285984","analyzedAt":"2026-08-26T18:04:05.187Z","schemaVersion":2},"datasetVersion":"2026-08-26T21:11:00.512Z"}