{"record":{"id":"2dc9ce87cad5758a","repo":"nodejs/node","slug":"an-error-occurred-processing-file-s-error-s","errorCode":null,"errorMessage":"An error occurred processing file %s. Error: %s","messagePattern":"An error occurred processing file (.+?)\\. Error: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/icu-small/source/tools/genrb/genrb.cpp","lineNumber":667,"sourceCode":"        } else {\n            openFileName.append(inputDir, status);\n        }\n    }\n    openFileName.appendPathPart(filename, status);\n\n    // Test for CharString failure\n    if (U_FAILURE(status)) {\n        return;\n    }\n\n    ucbuf.adoptInstead(ucbuf_open(openFileName.data(), &cp,getShowWarning(),true, &status));\n    if(status == U_FILE_ACCESS_ERROR) {\n\n        fprintf(stderr, \"couldn't open file %s\\n\", openFileName.data());\n        return;\n    }\n    if (ucbuf.isNull() || U_FAILURE(status)) {\n        fprintf(stderr, \"An error occurred processing file %s. Error: %s\\n\",\n                openFileName.data(), u_errorName(status));\n        return;\n    }\n    /* auto detected popular encodings? */\n    if (cp!=nullptr && isVerbose()) {\n        printf(\"autodetected encoding %s\\n\", cp);\n    }\n    /* Parse the data into an SRBRoot */\n    data.adoptInstead(parse(ucbuf.getAlias(), inputDir, outputDir, filename,\n            !omitBinaryCollation, options[NO_COLLATION_RULES].doesOccur, options[ICU4X_MODE].doesOccur, &status));\n\n    if (data.isNull() || U_FAILURE(status)) {\n        fprintf(stderr, \"couldn't parse the file %s. Error:%s\\n\", filename, u_errorName(status));\n        return;\n    }\n\n    // Run filtering before writing pool bundle\n    if (filterDir != nullptr) {","sourceCodeStart":649,"sourceCodeEnd":685,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/icu-small/source/tools/genrb/genrb.cpp#L649-L685","documentation":"The catch-all processing error in processFile(): ucbuf_open returned a non-null UCharacterStream but the status is a failure (not U_FILE_ACCESS_ERROR, which is handled separately by error 778), or the stream is null with a non-file-access error. The message includes the resolved filename and the ICU error name, covering encoding problems, BOM issues, malformed input, and stream construction failures.","triggerScenarios":"Source .txt in an encoding genrb cannot auto-detect and that conflicts with --encoding; missing or malformed BOM; binary garbage in a .txt; truncated UTF-8 sequences. Any UErrorCode other than U_FILE_ACCESS_ERROR coming out of ucbuf_open lands here.","commonSituations":"Mixing source encodings without specifying --encoding; files saved as UTF-16 without BOM; copy-pasting locale data through tools that mangle bytes; CRLF or non-character codepoints that the detector rejects.","solutions":["Pass the correct source encoding explicitly: `genrb --encoding UTF-8 root.txt`.","Re-save the offending .txt as UTF-8 (with or without BOM per ICU's expectations) using a reliable editor.","Read the printed u_errorName (e.g. U_UNSUPPORTED_ERROR, U_INVALID_CHAR_FOUND) to pinpoint encoding vs. parse causes.","If the file is generated upstream, fix the generator rather than papering over the encoding."],"exampleFix":"// before\ngenrb root.txt            # ambiguous encoding\n// after\ngenrb --encoding UTF-8 root.txt","handlingStrategy":"validation","validationCode":"# Preflight: confirm each source file is valid UTF-8 (or matches --encoding)\nenc=\"${ENCODING:-UTF-8}\"\nfor f in \"$@\"; do\n  if [ \"$enc\" = \"UTF-8\" ] && command -v iconv >/dev/null 2>&1; then\n    iconv -f UTF-8 -t UTF-8 \"$src_dir/$f\" >/dev/null 2>&1 || {\n      echo \"ERROR: $f is not valid UTF-8\" >&2; exit 2; }\n  fi\ndone","typeGuard":null,"tryCatchPattern":"genrb --encoding \"$enc\" -s \"$src_dir\" \"$@\" 2>err.log\nif grep -q 'An error occurred processing file' err.log; then\n  echo \"Source processing error; see err.log for the u_errorName and offending file\" >&2\n  exit 1\nfi","preventionTips":["Standardize all source .txt as UTF-8 with a BOM and pass --encoding UTF-8 explicitly.","Audit upstream generators that produce locale .txt to prevent encoding drift."],"tags":["icu","genrb","input-file","encoding","parse-error"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}