nodejs/node · warning

T_FileStream_remove failed to delete %s\n

Error message

T_FileStream_remove failed to delete %s\n

What it means

After (attempted) compilation of the arch-matching probe in pkg_createOptMatchArch, T_FileStream_remove(source) failed to delete the temporary .c file. This is a cleanup-only warning; the build continues. The name printed is the source path.

Source

Thrown at deps/icu-small/source/tools/pkgdata/pkgdata.cpp:2248

    stream = T_FileStream_open(source,"w");
    if (stream != nullptr) {
        T_FileStream_writeLine(stream, code);
        T_FileStream_close(stream);

        char cmd[LARGE_BUFFER_MAX_SIZE];
        snprintf(cmd, sizeof(cmd), "%s %s -o %s",
            pkgDataFlags[COMPILER],
            source,
            obj);

        if (runCommand(cmd) == 0){
            sprintf(optMatchArch, "%s", obj);
        }
        else {
            fprintf(stderr, "Failed to compile %s\n", source);
        }
        if(!T_FileStream_remove(source)){
            fprintf(stderr, "T_FileStream_remove failed to delete %s\n", source);
        }
    }
    else {
        fprintf(stderr, "T_FileStream_open failed to open %s for writing\n", source);
    }
#endif
}
static void pkg_destroyOptMatchArch(char *optMatchArch) {
    if(T_FileStream_file_exists(optMatchArch) && !T_FileStream_remove(optMatchArch)){
        fprintf(stderr, "T_FileStream_remove failed to delete %s\n", optMatchArch);
    }
}
#endif

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Confirm the build directory is writable (the temp file must be deletable).
  2. Close any process holding the file (antivirus, editor).
  3. If filesystem is intentionally read-only, redirect temp output to a writable temp dir.
  4. Treat as a benign warning if the build otherwise succeeds.

Example fix

# before: read-only build mount
mount -o remount,ro /build

# after: writable build tree
mount -o remount,rw /build
Defensive patterns

Strategy: fallback

Validate before calling

// Ensure the temp source path is deletable before the compile step runs.
#include <unistd.h>
bool tempFileRemovable(const char *p) { return access(p, F_OK) != 0 ? true : unlink(p) == 0; }

Prevention

When it happens

Trigger: The temp source file is read-only, held open by another process, on a read-only filesystem, or already removed; a sandbox/SELinux policy blocks unlink.

Common situations: Read-only build dir; antivirus or indexer holding the file open on Windows; container with a read-only bind mount of the build tree.

Related errors


AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13). Data as JSON: /api/errors/e5c078afe90c20ef. Report an issue: GitHub.