nodejs/node · error

U_FILE_ACCESS_ERROR

U_FILE_ACCESS_ERROR

Error message

error opening preparsed UCD file %s

What it means

Thrown by the PreparsedUCD constructor when fopen() fails to open the specified preparsed Unicode Character Database (UCD) file. The file path is printed (or 'no file name given' if null/empty), and errorCode is set to U_FILE_ACCESS_ERROR. This is the entry point for reading preparsed UCD data used by ICU's character property generation tools.

Source

Thrown at deps/icu-small/source/tools/toolutil/ppucd.cpp:64

PreparsedUCD::PreparsedUCD(const char *filename, UErrorCode &errorCode)
        : pnames(nullptr),
          file(nullptr),
          defaultLineIndex(-1), blockLineIndex(-1), lineIndex(0),
          lineNumber(0),
          lineType(NO_LINE),
          fieldLimit(nullptr), lineLimit(nullptr) {
    if(U_FAILURE(errorCode)) { return; }

    if(filename==nullptr || *filename==0 || (*filename=='-' && filename[1]==0)) {
        filename=nullptr;
        file=stdin;
    } else {
        file=fopen(filename, "r");
    }
    if(file==nullptr) {
        perror("error opening preparsed UCD");
        fprintf(stderr, "error opening preparsed UCD file %s\n", filename ? filename : "\"no file name given\"");
        errorCode=U_FILE_ACCESS_ERROR;
        return;
    }

    memset(ucdVersion, 0, 4);
    lines[0][0]=0;
}

PreparsedUCD::~PreparsedUCD() {
    if(file!=stdin) {
        fclose(file);
    }
}

// Same order as the LineType values.
static const char *lineTypeStrings[]={
    nullptr,
    nullptr,

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Verify the file path exists and is readable (ls -l, check permissions).
  2. Ensure the preparsed UCD file was generated by the ICU build system before running the tool that consumes it.
  3. Pass the correct absolute path or fix the build system's output directory configuration.

Example fix

// before: file path doesn't exist
PreparsedUCD *pucd = new PreparsedUCD("build/ucd/preparsed.txt", errorCode);

// after: verify path and pass correct location
// run: ls -l /path/to/icu/source/output/preparsed.txt
PreparsedUCD *pucd = new PreparsedUCD("/abs/path/to/output/preparsed.txt", errorCode);
if (U_FAILURE(errorCode)) { /* handle */ }
Defensive patterns

Strategy: validation

Validate before calling

// Validate file exists and is readable before constructing PreparsedUCD
import os
preparsed_path = 'build/ucd/preparsed.txt'
if not os.path.isfile(preparsed_path):
    raise FileNotFoundError(f'Preparsed UCD file not found: {preparsed_path}')
if not os.access(preparsed_path, os.R_OK):
    raise PermissionError(f'Cannot read preparsed UCD file: {preparsed_path}')

Try / catch

// C++: check errorCode after constructing PreparsedUCD
PreparsedUCD *pucd = new PreparsedUCD(filename, errorCode);
if (U_FAILURE(errorCode)) {
    if (errorCode == U_FILE_ACCESS_ERROR) {
        fprintf(stderr, "Cannot open preparsed UCD: %s\n", filename);
    }
    // handle error
    return;
}

Prevention

When it happens

Trigger: Constructing a PreparsedUCD object with a filename that does not exist, is not readable, or has incorrect permissions. The fopen(filename, "r") call returns nullptr, triggering the perror and fprintf at ppucd.cpp:64.

Common situations: Wrong or missing file path to the preparsed UCD file; file doesn't exist in the expected build directory; permission denied; build system pointing to a stale or non-existent path; typo in the filename argument.

Related errors


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