`mkdir` doesn't error on already-existing directory
Author: pickxCreated Sep 10, 2026Updated Sep 13, 2026
Labelsgood first issuestatus:needs-triage
Bug report form
- I have done a basic search of the issue tracker to find any existing issues that are similar.
- I have checked that my version is at least the latest stable release available via my installation method.
Describe the bug
mkdir for an existing path, including a path created by mkdir itself, returns exit code 0 as if a directory was created.
worse, mkdir --verbose reports the path as created: true.
to be clear, this doesn't match the behavior of GNU/coreutils mkdir or uutils/coreutils mkdir
How to reproduce
> cd (mktemp --directory)
> mkdir foo
> $ans.exit_code
0
> mkdir foo
> $ans.exit_code
0
> mkdir --verbose foo
╭───┬─────────────────────────────────────────────────────────────────────┬─────────┬───────╮
│ # │ path │ created │ error │
├───┼─────────────────────────────────────────────────────────────────────┼─────────┼───────┤
│ 0 │ /var/folders/n1/2s4wgvw17z75hspycqvqh8k00000gn/T/tmp.F2LC1Klmii/foo │ true │ │
╰───┴─────────────────────────────────────────────────────────────────────┴─────────┴───────╯
> ^/opt/homebrew/opt/uutils-coreutils/libexec/uubin/mkdir foo
mkdir: foo: File existsExpected behavior
error on the existing path. exit code should be 1 if at least one path was not created because it already exists (even though other paths may have been created). this matches uutils
also, mkdir --verbose should show it as an error.
Configuration
| key | value |
|---|---|
| version | 0.115.2 |
| major | 0 |
| minor | 115 |
| patch | 2 |
| branch | |
| commit_hash | f8ae9ac5d6be05ca4c6a32db5b40eff9a55c8aeb |
| build_os | macos-aarch64 |
| build_target | aarch64-apple-darwin |
| rust_version | rustc 1.96.1 (31fca3adb 2026-06-26) |
| rust_channel | 1.96.1-aarch64-apple-darwin |
| cargo_version | cargo 1.96.1 (356927216 2026-06-26) |
| build_time | 2026-09-06 00:17:18 +03:00 |
| build_rust_channel | release |
| allocator | standard |
| features | default, lsp, mcp, network, plugin, rustls-tls, sqlite, trash-support |
| installed_plugins | desktop_notifications 0.107.0, formats 0.107.0, highlight 1.4.9+0.107.0, json_path 0.17.1, query 0.107.0, regex 0.19.0, skim 0.22.0, strutils 0.21.0 |
| experimental_options | example=false, dc-glob=true, reorder-cell-paths=true, pipefail=true, enforce-runtime-annotations=true, native-clip=true, cell-path-types=true, background-completions=true |
Source: nushell/nushell