nodejs/node · warning

T_FileStream_open failed to open %s for writing\n

Error message

T_FileStream_open failed to open %s for writing\n

What it means

At the start of pkg_createOptMatchArch, T_FileStream_open(source,"w") returned nullptr so the probe source file could not be written. The else-branch reports it; the whole arch-matching step is skipped. This disables architecture matching but does not abort the build.

Source

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

        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. Ensure the working/output directory is writable by the build user.
  2. Free disk space on the relevant volume.
  3. Confirm no directory exists with the same name as the probe source file.
  4. Redirect output to a writable scratch directory if the build tree is locked.

Example fix

# before: pkgdata run in read-only dir
pkgdata -p mypkg  # CWD not writable

# after: run from a writable dir
cd /tmp/icu-build && pkgdata -p mypkg
Defensive patterns

Strategy: validation

Validate before calling

# Confirm the probe source's directory is writable.
DIR=$(pwd); [ -w "$DIR" ] || { echo "CWD not writable: $DIR"; exit 1; }

Prevention

When it happens

Trigger: The output directory for the probe source is not writable, the disk is full, the path is invalid, or a file/dir name collision exists.

Common situations: Running pkgdata in a directory the user cannot write; a full /tmp; the source path collides with an existing directory.

Related errors


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