nodejs/node · error

U_ILLEGAL_ARGUMENT_ERROR

U_ILLEGAL_ARGUMENT_ERROR

Error message

Error: %s is an unknown binary filename type.

What it means

While processing a binary resource for XLIFF output, genrb extracts the file extension from the resource's filename. If no extension is found (uprv_strrchr for '.' returns null), the tool cannot determine the MIME type and exits with U_ILLEGAL_ARGUMENT_ERROR. The recognized extensions are .jpg/.jpeg/.gif (image), .wav/.au (audio), .avi/.mpg/.mpeg (video), .txt/.text (text).

Source

Thrown at deps/icu-small/source/tools/genrb/wrtxml.cpp:839

    char* f = nullptr;

    fn[0]=0;

    if(res->fFileName != nullptr){
        uprv_strcpy(fileName, res->fFileName);
        f = uprv_strrchr(fileName, '\\');

        if (f != nullptr) {
            f++;
        } else {
            f = fileName;
        }

        ext = uprv_strrchr(fileName, '.');

        if (ext == nullptr) {
            fprintf(stderr, "Error: %s is an unknown binary filename type.\n", fileName);
            exit(U_ILLEGAL_ARGUMENT_ERROR);
        }

        if(uprv_strcmp(ext, ".jpg")==0 || uprv_strcmp(ext, ".jpeg")==0 || uprv_strcmp(ext, ".gif")==0 ){
            m_type = "image";
        } else if(uprv_strcmp(ext, ".wav")==0 || uprv_strcmp(ext, ".au")==0 ){
            m_type = "audio";
        } else if(uprv_strcmp(ext, ".avi")==0 || uprv_strcmp(ext, ".mpg")==0 || uprv_strcmp(ext, ".mpeg")==0){
            m_type = "video";
        } else if(uprv_strcmp(ext, ".txt")==0 || uprv_strcmp(ext, ".text")==0){
            m_type = "text";
        }

        sid = printContainer(res, bin_unit, binary_restype, m_type, id, status);

        write_tabs(out);

        write_utf8_file(out, UnicodeString(bin_source));

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Check the binary resource filename in the .txt source — it must have a recognized extension (.jpg, .jpeg, .gif, .wav, .au, .avi, .mpg, .mpeg, .txt, .text)
  2. Rename the binary file to include the correct extension
  3. If the extension is correct but unrecognized (e.g. .png), convert the file to a supported format or avoid XLIFF output for this bundle
  4. Verify the filename is not accidentally a directory path without a file component

Example fix

// before: binary resource without recognized extension
    icon { "my_image" }
// after: binary resource with recognized extension
    icon { "my_image.jpg" }
Defensive patterns

Strategy: validation

Validate before calling

# Check binary resource references have recognized extensions before genrb
SUPPORTED='jpg jpeg gif wav au avi mpg mpeg txt text'
for f in data/*.txt; do
    while IFS= read -r ref; do
        ref=$(echo "$ref" | tr -d '"')
        ext="${ref##*.}"
        echo "$SUPPORTED" | grep -qw "$ext" || echo "Unrecognized extension '.$ext' in $f: $ref"
    done < <(grep -oP '(?:import|importBinary)\s*"[^"]+"' "$f")
done

Prevention

When it happens

Trigger: A resource bundle references a binary file (import/importBinary directive) whose filename has no dot-extension. The tool's extension check finds no '.' in the filename and immediately exits. This is a hard validation failure in the XLIFF output path.

Common situations: Binary resource filename missing its extension due to a rename; filename uses a non-standard extension not in genrb's recognized list; filename is actually a directory path where uprv_strrchr found a directory separator but no dot; binary resource path constructed incorrectly by build tooling.

Related errors


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