nodejs/node · error
CPU architecture "%s" is unknown.\n
Error message
CPU architecture "%s" is unknown.\n
What it means
When -o/--object and -c/--cpu-arch are both in use, genccode calls checkCpuArchitecture() on the -c value. The accepted values are exactly x64, x86, arm64, arm (case-insensitive pairs). Any other string is rejected with this message and the tool returns -1 before generating object code.
Source
Thrown at deps/icu-small/source/tools/genccode/genccode.c:202
writeCCode(filename, options[kOptDestDir].value,
options[kOptEntryPoint].doesOccur ? options[kOptEntryPoint].value : NULL,
options[kOptName].doesOccur ? options[kOptName].value : NULL,
options[kOptFilename].doesOccur ? options[kOptFilename].value : NULL,
NULL,
0);
break;
case CALL_WRITEASSEMBLY:
writeAssemblyCode(filename, options[kOptDestDir].value,
options[kOptEntryPoint].doesOccur ? options[kOptEntryPoint].value : NULL,
options[kOptFilename].doesOccur ? options[kOptFilename].value : NULL,
NULL,
0);
break;
#ifdef CAN_GENERATE_OBJECTS
case CALL_WRITEOBJECT:
if(options[kOptCpuArch].doesOccur) {
if (!checkCpuArchitecture(options[kOptCpuArch].value)) {
fprintf(stderr,
"CPU architecture \"%s\" is unknown.\n", options[kOptCpuArch].value);
return -1;
}
}
writeObjectCode(filename, options[kOptDestDir].value,
options[kOptEntryPoint].doesOccur ? options[kOptEntryPoint].value : NULL,
options[kOptMatchArch].doesOccur ? options[kOptMatchArch].value : NULL,
options[kOptCpuArch].doesOccur ? options[kOptCpuArch].value : NULL,
options[kOptFilename].doesOccur ? options[kOptFilename].value : NULL,
NULL,
0,
!options[kOptSkipDllExport].doesOccur);
break;
#endif
default:
/* Should never occur. */
break;
}View on GitHub (pinned to 1b2de5e052)
Solutions
- Map your architecture to genccode's name: aarch64->arm64, amd64->x64, i386/i686->x86, armhf/armv7->arm.
- Drop -c if you do not need object generation with a specific arch (genccode will infer the host arch).
- Verify the spelling is exactly one of x64/x86/arm64/arm (case-insensitive).
Example fix
# before genccode -o -c aarch64 data.dat # after genccode -o -c arm64 data.dat
Defensive patterns
Strategy: type-guard
Validate before calling
// normalize host arch names to genccode's accepted set
ALIAS = {'aarch64':'arm64','amd64':'x64','x86_64':'x64','i386':'x86','i686':'x86','armhf':'arm','armv7l':'arm'}
cpu = ALIAS.get(host_arch.lower(), host_arch.lower())
if cpu not in {'x64','x86','arm64','arm'}:
raise ValueError(f'unsupported --cpu-arch {host_arch}; map to x64/x86/arm64/arm') Type guard
// type guard for genccode cpu-arch values
bool is_valid_cpu_arch(const char* a) {
return strcmp(a,"x64")==0||strcmp(a,"x86")==0||strcmp(a,"arm64")==0||strcmp(a,"arm")==0;
} Prevention
- Translate GNU-triple machine names to genccode names in one place (aarch64->arm64, amd64->x64).
- Omit -c entirely when host inference is acceptable.
When it happens
Trigger: options[kOptCpuArch].value is not one of {x64,x86,arm64,arm,X64,X86,ARM64,ARM}. Common misses: "aarch64" (use "arm64"), "amd64" (use "x64"), "i386"/"i686" (use "x86"), "armhf" (use "arm").
Common situations: Cross-compile scripts that pass the GNU triple's machine name (aarch64, amd64) instead of genccode's normalized names; CI matrices using architecture labels from a different vocabulary than ICU's; copying -c from a clang/gcc -march flag.
Related errors
- error in command line argument "%s"\n
- Assembly type "%s" is unknown.\n
- U_FILE_ACCESS_ERROR
- U_ILLEGAL_ARGUMENT_ERROR
- U_UNSUPPORTED_ERROR
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/c142305d80a042b8.
Report an issue: GitHub.