Skip to content

Undeletable nul file #13369

Closed
Closed

Description

@GTonehour

Open Code creates a nul file on the root directory of the project. That file can't be deleted on Windows.

Versions where the bug was reported

  • I personally encountered the bug using v1.1.60 on Windows 11 Pro 25H2...
  • ... and using 1.1.59 on Windows 11 Home 24H2.
  • @harunurhan reported the bug on 1.1.27
  • @rycerzes reported it on 1.1.21 using Windows 11 24H2
  • @Mojobucks reported downgrading from 1.1.15 to 1.1.14 fixed it

Issues mentioning that problem

Strategies to delete that file...

Activity

  1. github-actions commented on Feb 12, 2026

    @github-actions
    Contributor

    This issue appears to be a duplicate of existing open issues. Please check:

    These issues describe the same problem with the nul file being created and causing issues on Windows. Consider consolidating the discussion there to help maintainers track the fix.

  2. assigned and unassigned on Feb 12, 2026
  3. breggles commented on Feb 14, 2026

    @breggles

    Happens for me in OpenCode 1.2.1 on Windows 11. Can't delete in PowerShell, but can delete using File Explorer. Requires admin approval to delete.

  4. breggles commented on Feb 14, 2026

    @breggles

    PS: Claude says this: "This is almost certainly being created by OpenCode (or one of its tools) running on Windows. When code written for Unix tries to redirect output to /dev/null, on Windows that can inadvertently create a literal file named nul in the working directory."

  5. breggles commented on Feb 14, 2026

    @breggles

    ...can delete using File Explorer. Requires admin approval to delete.

    Scratch that, it just appears to delete it, but when i hit it F5 it's there again. So either it didn't actually get deleted, or it got re-created immediately? 🤔

  6. breggles commented on Feb 14, 2026

    @breggles

    Oh, there is a fix. Ignore me...

  7. harunurhan commented on Feb 20, 2026

    @harunurhan

    FYI, you can delete the file using something like this cmd /c del \\.\C:\path\to\nul, for the time being.

  8. Xenogix commented on Feb 25, 2026

    @Xenogix

    It looks like our version of this file contains stdout redirect data, which is possible to read through WSL (cat /mnt/c/path/to/nul)

    dir: cannot access '/s': No such file or directory
    dir: cannot access '*.dll': No such file or directory
    

    It is also possible to remove it easily with WSL using rm /mnt/c/path/to/nul

  9. kevin-regnology commented on Mar 1, 2026

    @kevin-regnology

    Here is what i found with codex:

    What’s going wrong

    • On Windows, opencode often runs commands via Git Bash.
    • The model sometimes emits Windows‑style redirection like > NUL.
    • In Git Bash, NUL is treated as a literal filename, so it creates a file named nul (a reserved device name). PowerShell then can’t delete it.

    Best fix

    • Normalize null‑device redirections before executing: if the shell is POSIX (bash/sh), rewrite NUL → /dev/null; if the shell is cmd/PowerShell, rewrite /dev/null → NUL.
    • Also surface the actual shell in the system prompt so the model doesn’t guess the wrong redirection syntax.

    Will see if the fix works locally.
    Btw. you can also delete the file with git bash.

  10. festoney8 commented on Mar 14, 2026

    @festoney8

    I can't delete it using any Windows command, and even DiskGenius returns an error, but in WSL works

  11. JustPlayground commented on Mar 16, 2026

    @JustPlayground

    I can't delete it using any Windows command, and even DiskGenius returns an error, but in WSL works

    try run in cmd:
    del "\\?\C:\path to it\nul"

    path must be absolute

  12. orhanmaden commented on Mar 26, 2026

    @orhanmaden

    I ask opencode to remove it and it works. It is annoying.

  13. OwenClaw commented on Apr 1, 2026

    @OwenClaw

    I tried a lot of commands in WINDOWS PowerShell or CMD, but finally only GitBash rm nul works

  14. Hona commented on Apr 1, 2026

    @Hona
    Member

    for windows users, opencode now uses powershell by default. so there wont be any pipe issues creating the nul files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingwindows

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions