{"record":{"id":"cd654849fba24074","repo":"antonmedv/fx","slug":"cannot-save-undefined","errorCode":null,"errorMessage":"Cannot save undefined","messagePattern":"Cannot save undefined","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"internal/engine/stdlib.js","lineNumber":188,"sourceCode":"      const copy = [...x]\n      copy.splice(key, 1)\n      return copy\n    }\n    if (typeof x === 'object' && x !== null) {\n      const copy = {...x}\n      delete copy[key]\n      return copy\n    }\n    throw new Error(`Cannot delete key from ${typeof x}`)\n  }\n}\n\nfunction exit(code) {\n  __exit__(code)\n}\n\nfunction save(x) {\n  if (typeof x === 'undefined') throw new Error('Cannot save undefined')\n  __save__(__stringify__(x, null, 2))\n  return x\n}\n\nfunction toBase64(x) {\n  return __toBase64__(x)\n}\n\nfunction fromBase64(x) {\n  return __fromBase64__(x)\n}\n\nconst YAML = {\n  stringify: x => __yaml_stringify__(x),\n  parse: x => JSON.parse(__yaml_parse__(x)),\n}\n","sourceCodeStart":170,"sourceCodeEnd":205,"githubUrl":"https://github.com/antonmedv/fx/blob/4f31cd3a0c5d66f1b4290a2719bab14a5cee8ebe/internal/engine/stdlib.js#L170-L205","documentation":"Guard inside the save() stdlib helper: it rejects calls with an argument that is undefined before serializing, since JSON.stringify would otherwise silently coerce undefined to nothing. Fires when script code calls save() with no argument or with an expression evaluating to undefined, e.g. a missing object property.","triggerScenarios":"Thrown at internal/engine/stdlib.js:188 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a defined value to save(), e.g. save(.) or save(result)","Check the variable before saving: if (typeof x !== 'undefined') save(x)","Use save(null) or save({}) if an explicit empty value is intended"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4f31cd3a0c5d66f1b4290a2719bab14a5cee8ebe","analyzedAt":"2026-09-02T02:17:47.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}