{"record":{"id":"32d285384c4eb136","repo":"parcel-bundler/parcel","slug":"append-isn-t-supported","errorCode":null,"errorMessage":"append isn't supported","messagePattern":"append isn't supported","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/repl/src/parcel/ExtendedMemoryFS.js","lineNumber":298,"sourceCode":"    let file = this.files.get(filePath);\n    if (flags & CONSTANTS.O_CREAT) {\n      if (file) {\n        if (flags & CONSTANTS.O_EXCL) {\n          throw new FSError('EEXIST', filePath, 'already exists');\n        }\n      } else {\n        file = new File(makeShared(''), mode);\n        this.files.set(filePath, file);\n      }\n    }\n    if (!file) {\n      throw new FSError('ENOENT', filePath, 'does not exist');\n    } else if (flags & CONSTANTS.O_TRUNC) {\n      file.write(makeShared(''), file.mode);\n    }\n\n    if (flags & CONSTANTS.O_APPEND) {\n      throw new Error(\"append isn't supported\");\n    }\n\n    let fd = this._nextFD(filePath);\n    this.openFDs.set(fd, {filePath, file, position: 0});\n    return fd;\n  }\n\n  readSync(\n    fdNum: number,\n    buffer: Buffer,\n    offset: any,\n    length: any,\n    position: any,\n  ): number {\n    if (length == null) {\n      ({offset, length, position} = offset);\n    }\n    let fd = this.openFDs.get(fdNum);","sourceCodeStart":280,"sourceCodeEnd":316,"githubUrl":"https://github.com/parcel-bundler/parcel/blob/59484858a1a0bcbb71f74088956bb437a2db6505/packages/dev/repl/src/parcel/ExtendedMemoryFS.js#L280-L316","documentation":"Thrown by `ExtendedMemoryFS.openSync` when the open flags include `O_APPEND`. The in-memory FS used by the REPL does not implement append mode at all — it is an explicit, unsupported-operation guard rather than a filesystem state error.","triggerScenarios":"Any `openSync(path, O_WRONLY | O_APPEND)` or flag combination resolving to O_APPEND (flag value 1024 or any OR including it), including the common `'a'` mode translated to flags.","commonSituations":"Logging code ported from Node that opens log files in append mode; build tooling that appends to a manifest file.","solutions":["Open in write mode and emulate append yourself: read current contents, concatenate, write back atomically.","Track an in-memory append buffer and rewrite the whole file on each flush.","Avoid relying on O_APPEND semantics inside the REPL memory FS."],"exampleFix":"// before\nconst fd = fs.openSync(p, O_WRONLY | O_APPEND);\n// after\nconst existing = fs.existsSync(p) ? fs.readFileSync(p, 'utf8') : '';\nfs.writeFileSync(p, existing + newChunk);","handlingStrategy":"validation","validationCode":"const O_APPEND = 1024;\nfunction assertNotAppend(flags) {\n  if (flags & O_APPEND) throw new Error('O_APPEND unsupported by ExtendedMemoryFS');\n}","typeGuard":"function flagsUseAppend(flags) { return (flags & 1024) !== 0; }","tryCatchPattern":null,"preventionTips":["Never pass O_APPEND to the REPL memory FS.","Emulate append with read-then-write.","Centralize file access behind a helper that rejects append flags."],"tags":["filesystem","memory-fs","open","unsupported","repl"],"backgroundTag":null,"analyzedSha":"59484858a1a0bcbb71f74088956bb437a2db6505","analyzedAt":"2026-08-13T04:06:35.925Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}