apache/maven · error · IllegalArgumentException

Unable to parse unicode value: {}

Error message

Unable to parse unicode value: {}

What it means

MavenProperties.unescapeJava processes Java-style escapes while Maven loads its properties files (installation conf/maven-system.properties, conf/maven-user.properties and their includes). When it meets `\u` the next four characters must be hex digits; Integer.parseInt(...,16) throwing NumberFormatException is wrapped as IllegalArgumentException 'Unable to parse unicode value'. The classic producer is an unescaped Windows path, where the `\u` of `\users` or `\util` starts an escape.

Source

Thrown at impl/maven-cli/src/main/java/org/apache/maven/cling/props/MavenProperties.java:603

        boolean hadSlash = false;
        boolean inUnicode = false;
        for (int i = 0; i < sz; i++) {
            char ch = str.charAt(i);
            if (inUnicode) {
                // if in unicode, then we're reading unicode
                // values in somehow
                unicode.append(ch);
                if (unicode.length() == UNICODE_LEN) {
                    // unicode now contains the four hex digits
                    // which represents our unicode character
                    try {
                        int value = Integer.parseInt(unicode.toString(), HEX_RADIX);
                        out.append((char) value);
                        unicode.setLength(0);
                        inUnicode = false;
                        hadSlash = false;
                    } catch (NumberFormatException nfe) {
                        throw new IllegalArgumentException("Unable to parse unicode value: " + unicode, nfe);
                    }
                }
                continue;
            }

            if (hadSlash) {
                // handle an escaped value
                hadSlash = false;
                switch (ch) {
                    case '\\':
                        out.append('\\');
                        break;
                    case '\'':
                        out.append('\'');
                        break;
                    case '\"':
                        out.append('"');
                        break;

View on GitHub (pinned to e4093d4e12)

Solutions

  1. Escape every backslash: `dir=C:\\users\\build`.
  2. Prefer forward slashes on Windows paths: `dir=C:/users/build`.
  3. Fix malformed \uXXXX escapes to carry exactly four hex digits (0-9, a-f).
  4. Regenerate the file with java.util.Properties.store, which escapes backslashes correctly.

Example fix

# before: '\u' in the path starts a unicode escape
dist.dir=C:\users\me\build

# after
dist.dir=C:/users/me/build
Defensive patterns

Strategy: validation

Validate before calling

Pattern BAD_UNICODE = Pattern.compile("\\\\u(?![0-9a-fA-F]{4})");
for (String line : Files.readAllLines(propsFile, StandardCharsets.UTF_8)) {
    if (BAD_UNICODE.matcher(line).find()) {
        throw new IllegalArgumentException("Invalid \\u escape in " + propsFile + ": " + line);
    }
}

Prevention

When it happens

Trigger: A property value containing a backslash-u sequence not followed by exactly four hex digits, e.g. `dir=C:\users\build` (the `\use` after `C:` is read as a unicode escape), or a hand-typed `\u00G1`.

Common situations: Windows paths pasted into the installation's properties files; generated files that do not escape backslashes; values copied from documentation containing literal backslashes.

Understand the failure class

Related errors


AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21). Data as JSON: /api/errors/920dd32be2951642. Report an issue: GitHub.