Skip to content

fs.mkdirSync with recursive: true throws ENOENT instead of ENOSPC when disk is full #42808

@thynson

Description

@thynson

Version

16.14.1

Platform

Linux

Subsystem

No response

What steps will reproduce the bug?

No response

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior?

Same as fs.mkdirSync without options:

> fs.mkdirSync('./a')
Uncaught Error: ENOSPC: no space left on device, mkdir './a'
    at Object.mkdirSync (node:fs:1336:3) {
  errno: -28,
  syscall: 'mkdir',
  code: 'ENOSPC',
  path: './a'
}

What do you see instead?

> fs.mkdirSync('./a', {recursive: true})
Uncaught Error: ENOENT: no such file or directory, mkdir './a'
    at Object.mkdirSync (node:fs:1336:3) {
  errno: -2,
  syscall: 'mkdir',
  code: 'ENOENT',

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    fsIssues and PRs related to the fs subsystem / file system.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions