nodejs / nodejs/node

`openAsBlob` fails synchronously

Open Beginner friendly
#62,418 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

fs
Dominant language
JavaScript
Stars
122k
Forks
37.3k
Avg merge
4d 2h
Merged PRs (30d)
283

Description

Version

v24.14.0

Platform
Linux vali 6.18.7-76061807-generic #202601231045~1769703228~24.04~cb87b5b SMP PREEMPT_DYNAMIC Thu J x86_64 x86_64 x86_64 GNU/Linux
Subsystem

fs

What steps will reproduce the bug?
import { openAsBlob } from 'node:fs'

const result = await openAsBlob('does-not-exist').catch((error) => {})

console.log(result)
How often does it reproduce? Is there a required condition?

Always

What is the expected behavior? Why is that the expected behavior?

I expect openAsBlob() to always return a promise. If there are any problems, I expect the promise to be rejected.

What do you see instead?

Instead of returning a promise that’s rejected, openAsBlob() fails synchronously. This means that instead of using the Promise.catch() method, you have to use try/catch logic instead.

Additional information

Just marking the function as async on https://github.com/nodejs/node/blob/v25.8.1/lib/fs.js#L570 would fix it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lib/fs.js near the openAsBlob() implementation at the referenced line and reproduce the failure with the provided missing-path example. Check the surrounding fs tests or add coverage for the error case. Done means openAsBlob() returns a promise and the missing path is reported through promise rejection rather than a synchronous throw.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.