nodejs/node · error
%s: could not open input file %s\n
Error message
%s: could not open input file %s\n
What it means
convert() opens the input file with std::ifstream::open and checks is_open(). If opening fails (missing path, no read permission, or directory), it prints this message, calls cleanup() to delete any stale output, and returns 1. This guards against silently producing output from a nonexistent input.
Source
Thrown at deps/icu-small/source/tools/escapesrc/escapesrc.cpp:375
//fprintf(stderr, "%d - fixed\n", no);
return false;
}
/**
* Convert a whole file
* @param infile
* @param outfile
* @return 1 on err, 0 otherwise
*/
int convert(const std::string &infile, const std::string &outfile) {
fprintf(stderr, "escapesrc: %s -> %s\n", infile.c_str(), outfile.c_str());
std::ifstream inf;
inf.open(infile.c_str(), std::ios::in);
if(!inf.is_open()) {
fprintf(stderr, "%s: could not open input file %s\n", prog.c_str(), infile.c_str());
cleanup(outfile);
return 1;
}
std::ofstream outf;
outf.open(outfile.c_str(), std::ios::out);
if(!outf.is_open()) {
fprintf(stderr, "%s: could not open output file %s\n", prog.c_str(), outfile.c_str());
return 1;
}
// TODO: any platform variations of #line?
outf << "#line 1 \"" << infile << "\"" << '\n';
int no = 0;
std::string linestr;View on GitHub (pinned to 1b2de5e052)
Solutions
- Verify the input path exists and is readable: check the path printed in the message, resolve it relative to escapesrc's cwd.
- Fix the build dependency so the input file is generated before escapesrc runs.
- Correct file permissions or ownership if access is denied.
Defensive patterns
Strategy: validation
Validate before calling
import os
if not os.path.isfile(infile) or not os.access(infile, os.R_OK):
raise FileNotFoundError(f'escapesrc input not readable: {infile}') Prevention
- Declare the input as a build dependency so the build system guarantees it exists.
- Log escapesrc's working directory in build rules to catch relative-path mistakes.
When it happens
Trigger: inf.open(infile) fails: the path does not exist, points to a directory rather than a file, lacks read permission, or contains a typo. is_open() returns false in all these cases.
Common situations: Wrong relative path because the tool's working directory differs from the build rule's expectation; a generated input that an earlier build step failed to produce; permission/ownership mismatch in a CI container; a make/ninja dependency edge missing so the input is not yet built.
Related errors
- %s: could not open output file %s\n
- Unable to create map file: %s.\n
- U_FILE_ACCESS_ERROR
- T_FileStream_remove failed to delete %s\n
- T_FileStream_open failed to open %s for writing\n
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/e7ec3cf12d707edb.
Report an issue: GitHub.