{"record":{"id":"318e36b867427c7b","repo":"nodejs/node","slug":"u-illegal-argument-error","errorCode":"U_ILLEGAL_ARGUMENT_ERROR","errorMessage":"Error: %s is an unknown binary filename type.","messagePattern":"Error: (.+?) is an unknown binary filename type\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/icu-small/source/tools/genrb/wrtxml.cpp","lineNumber":839,"sourceCode":"\n    char* f = nullptr;\n\n    fn[0]=0;\n\n    if(res->fFileName != nullptr){\n        uprv_strcpy(fileName, res->fFileName);\n        f = uprv_strrchr(fileName, '\\\\');\n\n        if (f != nullptr) {\n            f++;\n        } else {\n            f = fileName;\n        }\n\n        ext = uprv_strrchr(fileName, '.');\n\n        if (ext == nullptr) {\n            fprintf(stderr, \"Error: %s is an unknown binary filename type.\\n\", fileName);\n            exit(U_ILLEGAL_ARGUMENT_ERROR);\n        }\n\n        if(uprv_strcmp(ext, \".jpg\")==0 || uprv_strcmp(ext, \".jpeg\")==0 || uprv_strcmp(ext, \".gif\")==0 ){\n            m_type = \"image\";\n        } else if(uprv_strcmp(ext, \".wav\")==0 || uprv_strcmp(ext, \".au\")==0 ){\n            m_type = \"audio\";\n        } else if(uprv_strcmp(ext, \".avi\")==0 || uprv_strcmp(ext, \".mpg\")==0 || uprv_strcmp(ext, \".mpeg\")==0){\n            m_type = \"video\";\n        } else if(uprv_strcmp(ext, \".txt\")==0 || uprv_strcmp(ext, \".text\")==0){\n            m_type = \"text\";\n        }\n\n        sid = printContainer(res, bin_unit, binary_restype, m_type, id, status);\n\n        write_tabs(out);\n\n        write_utf8_file(out, UnicodeString(bin_source));","sourceCodeStart":821,"sourceCodeEnd":857,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/icu-small/source/tools/genrb/wrtxml.cpp#L821-L857","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["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)","Rename the binary file to include the correct extension","If the extension is correct but unrecognized (e.g. .png), convert the file to a supported format or avoid XLIFF output for this bundle","Verify the filename is not accidentally a directory path without a file component"],"exampleFix":"// before: binary resource without recognized extension\n    icon { \"my_image\" }\n// after: binary resource with recognized extension\n    icon { \"my_image.jpg\" }","handlingStrategy":"validation","validationCode":"# Check binary resource references have recognized extensions before genrb\nSUPPORTED='jpg jpeg gif wav au avi mpg mpeg txt text'\nfor f in data/*.txt; do\n    while IFS= read -r ref; do\n        ref=$(echo \"$ref\" | tr -d '\"')\n        ext=\"${ref##*.}\"\n        echo \"$SUPPORTED\" | grep -qw \"$ext\" || echo \"Unrecognized extension '.$ext' in $f: $ref\"\n    done < <(grep -oP '(?:import|importBinary)\\s*\"[^\"]+\"' \"$f\")\ndone","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure all binary resource references use file extensions recognized by genrb (.jpg, .jpeg, .gif, .wav, .au, .avi, .mpg, .mpeg, .txt, .text)","Convert binary files to supported formats before referencing them in resource bundles","Validate binary resource filenames in a pre-build check when using XLIFF output mode"],"tags":["icu","genrb","xliff","binary","filename","mime-type"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}