nodejs/node · error

U_ILLEGAL_ARGUMENT_ERROR

U_ILLEGAL_ARGUMENT_ERROR

Error message

pkgdata: 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

What it means

A token in the file list is an absolute path (uprv_pathIsAbsolute true) or begins with '.', which pkgdata rejects because it only accepts bare relative names like 'fur.res' or 'translit/fur.res'. The process exits with U_ILLEGAL_ARGUMENT_ERROR. The bad path is printed so it can be found and rewritten.

Source

Thrown at deps/icu-small/source/tools/pkgdata/pkgdata.cpp:2130

                            *lineNext = 0;
                            lineNext++;
                        }
                    }
                } else {
                    lineNext = uprv_strchr(linePtr, ' ');
                    if(lineNext) {
                        *lineNext = 0; /* terminate at space */
                        lineNext++;
                    }
                }

                /* add the file */
                s = const_cast<char*>(getLongPathname(linePtr));

                /* normal mode.. o->files is just the bare list without package names */
                o->files = pkg_appendToList(o->files, &tail, uprv_strdup(linePtr));
                if(uprv_pathIsAbsolute(s) || s[0] == '.') {
                    fprintf(stderr, "pkgdata: 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, s);
                    exit(U_ILLEGAL_ARGUMENT_ERROR);
                }
                /* The +5 is to add a little extra space for, among other things, PKGDATA_FILE_SEP_STRING */
                tmpLength = static_cast<int32_t>(uprv_strlen(o->srcDir) + uprv_strlen(s) + 5);
                if ((tmp = static_cast<char*>(uprv_malloc(tmpLength))) == nullptr) {
                    fprintf(stderr, "pkgdata: Error: Unable to allocate tmp buffer size: %d\n", tmpLength);
                    exit(U_MEMORY_ALLOCATION_ERROR);
                }
                uprv_strcpy(tmp, o->srcDir);
                uprv_strcat(tmp, o->srcDir[uprv_strlen(o->srcDir)-1] == U_FILE_SEP_CHAR ? "" : PKGDATA_FILE_SEP_STRING);
                uprv_strcat(tmp, s);
                o->filePaths = pkg_appendToList(o->filePaths, &tail2, tmp);
                linePtr = lineNext;
            } /* for each entry on line */
        } /* for each line */
        T_FileStream_close(in);
    } /* for each file list file */
}

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Strip absolute prefixes and leading './' or '../' from each entry, leaving only the relative tail.
  2. Use the -O srcDir option to supply the base directory instead of embedding it in each path.
  3. Regenerate the list so entries are bare names (e.g. locale.res) or subpaths (translit/de.res).
  4. Audit the file list for any line where the first char is '/', '\', or '.'.

Example fix

# before: absolute / dot paths
/usr/share/icu/res/fur.res
./cur.res

# after: bare relative names; pass base with -O
fur.res
cur.res
# invoke: pkgdata -O /usr/share/icu/res -F list.txt -p mypkg
Defensive patterns

Strategy: validation

Validate before calling

# Flag any absolute or dot-relative entry; pkgdata wants bare relative names.
awk '/^\// || /^\.\// || /^\.\.\// || /^[A-Za-z]:[\\\/]/ || /^\\/ {
  printf "%s:%d absolute/dot path not allowed: %s\n", FILENAME, FNR, $0; exit 1
}' reslist.txt

Prevention

When it happens

Trigger: A file-list entry starting with '/' (POSIX absolute), a drive letter/backslash (Windows absolute), or a leading '.' (./ or ../). The check fires before srcDir is joined, so any leading dir component is forbidden except a subpath with no leading separator.

Common situations: Migrating an old-style ICU data file list that used absolute paths; a build system that prepends $(CURDIR)/ to each resource; using ../ to reference sibling build dirs.

Related errors


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