{"record":{"id":"907e6afc0b04e5d8","repo":"nodejs/node","slug":"t-filestream-open-failed-to-open-s-for-writing-n","errorCode":null,"errorMessage":"T_FileStream_open failed to open %s for writing\\n","messagePattern":"T_FileStream_open failed to open (.+?) for writing\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"deps/icu-small/source/tools/pkgdata/pkgdata.cpp","lineNumber":2252,"sourceCode":"\n        char cmd[LARGE_BUFFER_MAX_SIZE];\n        snprintf(cmd, sizeof(cmd), \"%s %s -o %s\",\n            pkgDataFlags[COMPILER],\n            source,\n            obj);\n\n        if (runCommand(cmd) == 0){\n            sprintf(optMatchArch, \"%s\", obj);\n        }\n        else {\n            fprintf(stderr, \"Failed to compile %s\\n\", source);\n        }\n        if(!T_FileStream_remove(source)){\n            fprintf(stderr, \"T_FileStream_remove failed to delete %s\\n\", source);\n        }\n    }\n    else {\n        fprintf(stderr, \"T_FileStream_open failed to open %s for writing\\n\", source);\n    }\n#endif\n}\nstatic void pkg_destroyOptMatchArch(char *optMatchArch) {\n    if(T_FileStream_file_exists(optMatchArch) && !T_FileStream_remove(optMatchArch)){\n        fprintf(stderr, \"T_FileStream_remove failed to delete %s\\n\", optMatchArch);\n    }\n}\n#endif\n","sourceCodeStart":2234,"sourceCodeEnd":2262,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/icu-small/source/tools/pkgdata/pkgdata.cpp#L2234-L2262","documentation":"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.","triggerScenarios":"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.","commonSituations":"Running pkgdata in a directory the user cannot write; a full /tmp; the source path collides with an existing directory.","solutions":["Ensure the working/output directory is writable by the build user.","Free disk space on the relevant volume.","Confirm no directory exists with the same name as the probe source file.","Redirect output to a writable scratch directory if the build tree is locked."],"exampleFix":"# before: pkgdata run in read-only dir\npkgdata -p mypkg  # CWD not writable\n\n# after: run from a writable dir\ncd /tmp/icu-build && pkgdata -p mypkg","handlingStrategy":"validation","validationCode":"# Confirm the probe source's directory is writable.\nDIR=$(pwd); [ -w \"$DIR\" ] || { echo \"CWD not writable: $DIR\"; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run pkgdata from a writable directory.","Free disk space on the working volume.","Avoid name collisions between source files and directories.","Redirect temp output to a scratch dir if the tree is locked."],"tags":["icu","pkgdata","build-tool","file-io","filesystem","permissions"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}