oracle/graal · error · IllegalArgumentException

Unsupported Unicode character property '%s'

Error message

Unsupported Unicode character property '%s'

What it means

After alias lookup, normalizePropertyName checks the resolved name against OTHER_PROPERTIES_NAMES_SET when the flavor/options disable 'OtherProperties'. Names in that set (e.g. ECMAScript 'Other_' convenience properties) are intentionally excluded, so using them throws IllegalArgumentException "Unsupported Unicode character property '%s'".

Source

Thrown at regex/src/com.oracle.truffle.regex/src/com/oracle/truffle/regex/charset/UnicodeProperties.java:189

                case "scx":
                    propertyValue = normalizeScriptName(propertyValue);
                    break;
                default:
                    CompilerDirectives.transferToInterpreterAndInvalidate();
                    throw new IllegalArgumentException(String.format("Binary property %s cannot appear to the left of '=' in a Unicode property escape", propertySpec.substring(0, equals)));
            }
            return propertyName + "=" + propertyValue;
        } else if (isSupportedGeneralCategory(propertySpec)) {
            return "gc=" + normalizeGeneralCategoryName(propertySpec);
        } else {
            return normalizePropertyName(propertySpec);
        }
    }

    private String normalizePropertyName(String propertyName) {
        String name = returnOrThrow(propertyName, "character property", data.lookupPropertyAlias(propertyName, nameMatchingMode));
        if (!withOtherProperties() && OTHER_PROPERTIES_NAMES_SET.contains(name)) {
            throw new IllegalArgumentException(String.format("Unsupported Unicode character property '%s'", propertyName));
        }
        return name;
    }

    private String normalizeGeneralCategoryName(String generalCategoryName) {
        return returnOrThrow(generalCategoryName, "character general category", data.lookupGeneralCategoryAlias(generalCategoryName, nameMatchingMode));
    }

    private String normalizeScriptName(String scriptName) {
        return returnOrThrow(scriptName, "script name", data.lookupScriptAlias(scriptName, nameMatchingMode));
    }

    private String normalizeBlockName(String blockName) {
        if (!withBlocks()) {
            throw new IllegalArgumentException("Unsupported Unicode character property escape");
        }
        return returnOrThrow(blockName, "block name", data.lookupBlockAlias(blockName, nameMatchingMode));
    }

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Replace Other_* properties with the underlying core property or an explicit character class.
  2. Keep flavor-specific patterns separate and only use Other_* where the flavor enables them.
  3. Enable a flavor/options set that supports other-properties if your use case requires them.

Example fix

// before
String p = "\\p{Other_Uppercase}"; // throws in flavors with withOtherProperties()==false

// after
String p = "\\p{Uppercase}"; // core property, supported everywhere
Defensive patterns

Strategy: validation

Validate before calling

private static final Set<String> OTHER_PROPS = Set.of(
    "Other_Alphabetic", "Other_Uppercase", "Other_Lowercase", "Other_Ideographic");

static boolean safeForFlavor(String propertyName, boolean flavorSupportsOther) {
    return flavorSupportsOther || !OTHER_PROPS.contains(propertyName);
}

Prevention

When it happens

Trigger: Using a property from the OtherProperties set (such as \p{Other_Alphabetic} style names) in a regex compiled with options where withOtherProperties() is false — typically flavors/modes that only expose the core Unicode property set.

Common situations: Sharing one pattern string across multiple regex flavors (e.g. ECMAScript host and a non-ECMAScript flavor); patterns relying on ECMAScript 'Other_*' convenience properties run under a JavaUtilPattern-like or reduced-property configuration.

Related errors


AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14). Data as JSON: /api/errors/d3b01ae0e1bb2b22. Report an issue: GitHub.