parcel-bundler/parcel · error · Error

append isn't supported

Error message

append isn't supported

What it means

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.

Source

Thrown at packages/dev/repl/src/parcel/ExtendedMemoryFS.js:298

    let file = this.files.get(filePath);
    if (flags & CONSTANTS.O_CREAT) {
      if (file) {
        if (flags & CONSTANTS.O_EXCL) {
          throw new FSError('EEXIST', filePath, 'already exists');
        }
      } else {
        file = new File(makeShared(''), mode);
        this.files.set(filePath, file);
      }
    }
    if (!file) {
      throw new FSError('ENOENT', filePath, 'does not exist');
    } else if (flags & CONSTANTS.O_TRUNC) {
      file.write(makeShared(''), file.mode);
    }

    if (flags & CONSTANTS.O_APPEND) {
      throw new Error("append isn't supported");
    }

    let fd = this._nextFD(filePath);
    this.openFDs.set(fd, {filePath, file, position: 0});
    return fd;
  }

  readSync(
    fdNum: number,
    buffer: Buffer,
    offset: any,
    length: any,
    position: any,
  ): number {
    if (length == null) {
      ({offset, length, position} = offset);
    }
    let fd = this.openFDs.get(fdNum);

View on GitHub (pinned to 59484858a1)

Solutions

  1. Open in write mode and emulate append yourself: read current contents, concatenate, write back atomically.
  2. Track an in-memory append buffer and rewrite the whole file on each flush.
  3. Avoid relying on O_APPEND semantics inside the REPL memory FS.

Example fix

// before
const fd = fs.openSync(p, O_WRONLY | O_APPEND);
// after
const existing = fs.existsSync(p) ? fs.readFileSync(p, 'utf8') : '';
fs.writeFileSync(p, existing + newChunk);
Defensive patterns

Strategy: validation

Validate before calling

const O_APPEND = 1024;
function assertNotAppend(flags) {
  if (flags & O_APPEND) throw new Error('O_APPEND unsupported by ExtendedMemoryFS');
}

Type guard

function flagsUseAppend(flags) { return (flags & 1024) !== 0; }

Prevention

When it happens

Trigger: 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.

Common situations: Logging code ported from Node that opens log files in append mode; build tooling that appends to a manifest file.

Related errors


AI-assisted analysis of parcel-bundler/parcel@59484858a1 (2026-08-13). Data as JSON: /api/errors/32d285384c4eb136. Report an issue: GitHub.