nodejs/node · error

U_ILLEGAL_ARGUMENT_ERROR

U_ILLEGAL_ARGUMENT_ERROR

Error message

gencmn: Error: absolute path encountered. Old style paths are not supported. Use relative paths such as 'fur.res' or 'translit%cfur.res'.\n	Bad path: '%s'\n

What it means

A listed filename is absolute (uprv_pathIsAbsolute true) and gencmn rejects it: old-style absolute paths are not supported, only relative paths like 'fur.res' or 'translit/fur.res'. Prints guidance + the bad path and exit(U_ILLEGAL_ARGUMENT_ERROR).

Source

Thrown at deps/icu-small/source/tools/toolutil/pkg_gencmn.cpp:426

addFile(const char *filename, const char *name, const char *source, UBool sourceTOC, UBool verbose) {
    char *s;
    uint32_t length;
    char *fullPath = nullptr;

    if(fileCount==fileMax) {
      fileMax += CHUNK_FILE_COUNT;
      files = static_cast<File*>(uprv_realloc(files, fileMax * sizeof(files[0]))); /* note: never freed. */
      if(files==nullptr) {
        fprintf(stderr, "pkgdata/gencmn: Could not allocate %u bytes for %d files\n", static_cast<unsigned int>(fileMax * sizeof(files[0])), fileCount);
        exit(U_MEMORY_ALLOCATION_ERROR);
      }
    }

    if(!sourceTOC) {
        FileStream *file;

        if(uprv_pathIsAbsolute(filename)) {
            fprintf(stderr, "gencmn: Error: absolute path encountered. Old style paths are not supported. Use relative paths such as 'fur.res' or 'translit%cfur.res'.\n\tBad path: '%s'\n", U_FILE_SEP_CHAR, filename);
            exit(U_ILLEGAL_ARGUMENT_ERROR);
        }
        fullPath = pathToFullPath(filename, source);
        /* store the pathname */
        length = static_cast<uint32_t>(uprv_strlen(filename) + 1 + uprv_strlen(name) + 1);
        s=allocString(length);
        uprv_strcpy(s, name);
        uprv_strcat(s, U_TREE_ENTRY_SEP_STRING);
        uprv_strcat(s, filename);

        /* get the basename */
        fixDirToTreePath(s);
        files[fileCount].basename=s;
        files[fileCount].basenameLength=length;

        files[fileCount].pathname=fullPath;

        basenameTotal+=length;

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Strip the absolute prefix from list entries so they are relative to the source dir: `sed -E 's#^/##; s#^[A-Za-z]:[\\/]##'` is a quick fix, but better to fix the generator.
  2. Regenerate the list using relative paths from the directory gencmn is run in.
  3. Run gencmn from the directory the data files live in and pass relative names.
  4. Validate the list before running: reject lines matching ^/ or ^[A-Za-z]:[\\/].

Example fix

# before (list line)
/home/build/icudt75l/fur.res
# after
fur.res
Defensive patterns

Strategy: validation

Validate before calling

# reject absolute paths in the list before invoking gencmn
if grep -nE '^/|^[A-Za-z]:[\\/]' "$LIST"; then echo "absolute paths forbidden" >&2; exit 1; fi

Prevention

When it happens

Trigger: The input list contains an entry beginning with '/' (or a drive root on Windows), e.g. /home/user/build/icudt/fur.res. The check fires in addFile only when !sourceTOC, before pathToFullPath.

Common situations: A list generator that emits absolute paths instead of relative; copying a list from another machine that baked in absolute build dirs; Windows list with C:\\ prefixes.

Related errors


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