nodejs/node · info
%s: usage: %s infile.cpp outfile.cpp
Error message
%s: usage: %s infile.cpp outfile.cpp
What it means
Printed by escapesrc's usage() function when the tool is invoked with the wrong number of arguments. escapesrc is an ICU build-time tool that rewrites C/C++ source files to escape non-ASCII bytes into \u/\U sequences for EBCDIC-friendliness. The message documents the required invocation shape: progname infile outfile. It is an informational usage banner, not a runtime fault.
Source
Thrown at deps/icu-small/source/tools/escapesrc/escapesrc.cpp:61
static const char
kSPACE = 0x20,
kTAB = 0x09,
kLF = 0x0A,
kCR = 0x0D;
// For convenience
# define cp1047_to_8859(c) cp1047_8859_1[c]
// Our app's name
std::string prog;
/**
* Give the usual 1-line documentation and exit
*/
void usage() {
fprintf(stderr, "%s: usage: %s infile.cpp outfile.cpp\n", prog.c_str(), prog.c_str());
}
/**
* Delete the output file (if any)
* We want to delete even if we didn't generate, because it might be stale.
*/
int cleanup(const std::string &outfile) {
const char *outstr = outfile.c_str();
if(outstr && *outstr) {
int rc = std::remove(outstr);
if(rc == 0) {
fprintf(stderr, "%s: deleted %s\n", prog.c_str(), outstr);
return 0;
} else {
if( errno == ENOENT ) {
return 0; // File did not exist - no error.
} else {
perror("std::remove");View on GitHub (pinned to 1b2de5e052)
Solutions
- Invoke as exactly: escapesrc infile.cpp outfile.cpp (two file paths, no options).
- If you reached this from a build, inspect the failing command line in the build log and correct the rule that passes the wrong arg count.
- Remove any unrecognized flags — escapesrc parses no options, so any token that is not a path counts as an argument.
Example fix
// before escapesrc -o out.cpp in.cpp // after escapesrc in.cpp out.cpp
Defensive patterns
Strategy: validation
Validate before calling
// before invoking escapesrc, assert the arg shape
if (argc != 3) { fputs("usage: escapesrc infile outfile\n", stderr); return 2; }
// then: execlp("escapesrc", "escapesrc", infile, outfile, (char*)NULL); Prevention
- Wrap the escapesrc call in a build macro that takes exactly (in,out) so callers cannot pass a third arg.
- Treat any non-zero exit from escapesrc as a hard build failure.
When it happens
Trigger: main() calls usage() when argc != 3 (i.e. any count other than exactly one program name plus exactly two file arguments). Passing zero, one, three, or more positional arguments, or using unknown flags (escapesrc has no option parser), triggers it.
Common situations: Running escapesrc from a hand-typed command line in a custom build; a Makefile or GN/ninja rule that forwards a wrong number of args (e.g. quoting a glob that expands to many files, or passing an extra -o flag); invoking the binary with --help or no args to discover behavior.
Related errors
- Illegal code point U+%X\n
- Not a 'u'?
- Quote is '%c' - not sure what to do.\n
- Cannot do u8'...'\n
- Illegal utf-8 sequence at Column: %d\n
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/807f3c2122fae308.
Report an issue: GitHub.