Skip to content

Parcel.js: TypeError: Cannot read properties of undefined when all builds abort — results.pop() returns undefined #10344

Description

@tsushanth

Bug

In packages/core/core/src/Parcel.js around line 358, the code does:

let result = results.filter(Boolean).pop();
result.type // TypeError if all builds were aborted

When all pending builds are aborted, results.filter(Boolean) produces an empty array and .pop() returns undefined. The subsequent property access (result.type or similar) throws:

TypeError: Cannot read properties of undefined (reading 'type')

Reproduction

Trigger a build abort (e.g. via AbortController) while multiple builds are queued or in-flight. The crash surfaces in the build result aggregation path.

Fix

Add a null guard before accessing result:

let result = results.filter(Boolean).pop();
if (!result) {
  return; // or handle as appropriate — all builds were aborted
}
// safe to use result.type here

Notes

This is distinct from the sort comparator and env invalidation hash issues in PR #10341 — this is a separate null-deref in the abort path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions