oracle/graal · error · IllegalArgumentException

Invalid directed inlining rules file path: {path}

Error message

Invalid directed inlining rules file path: {path}

What it means

DirectedInliningRules.parseCommandFile (DirectedInliningRules.java:223) converts the directed-inlining rules file option value into a java.nio Path. If Path.of() throws InvalidPathException, the option value is not a valid path on this platform and an IllegalArgumentException wraps it.

Source

Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/phases/common/inlining/DirectedInliningRules.java:223

        }

        for (String ruleSpec : splitTopLevel(optionValue, DIRECTIVE_SEPARATOR)) {
            String trimmedRule = ruleSpec.trim();
            if (!trimmedRule.isEmpty()) {
                rules.add(parseRule(trimmedRule));
            }
        }
    }

    private static void parseCommandFile(String commandFileOptionValue, ArrayList<Rule> inlineRules, ArrayList<Rule> dontInlineRules) {
        if (commandFileOptionValue == null || commandFileOptionValue.trim().isEmpty()) {
            return;
        }
        Path commandFile;
        try {
            commandFile = Path.of(commandFileOptionValue.trim());
        } catch (InvalidPathException e) {
            throw new IllegalArgumentException("Invalid directed inlining rules file path: " + commandFileOptionValue, e);
        }
        List<String> lines;
        try {
            lines = Files.readAllLines(commandFile, StandardCharsets.UTF_8);
        } catch (IOException e) {
            throw new IllegalArgumentException("Could not read directed inlining rules file: " + commandFile, e);
        }
        for (int i = 0; i < lines.size(); i++) {
            parseCommandFileLine(commandFile, i + 1, lines.get(i), inlineRules, dontInlineRules);
        }
    }

    private static void parseCommandFileLine(Path commandFile, int lineNumber, String line, ArrayList<Rule> inlineRules, ArrayList<Rule> dontInlineRules) {
        String commandLine = stripComment(line).trim();
        if (commandLine.isEmpty()) {
            return;
        }
        int commandSeparator = findCommandSeparator(commandLine);

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Print and inspect the exact option value actually passed to the JVM; fix quoting/escaping in the launcher script
  2. Use a plain relative or absolute path with no special characters and verify it resolves from the JVM's working directory
  3. Test the path with Path.of(...) in a scratch program if unsure which character is invalid

Example fix

# before
java -Dgraal.DirectedInliningCommandFile="rules.txt"" App

# after
java -Dgraal.DirectedInliningCommandFile=rules.txt App
Defensive patterns

Strategy: validation

Validate before calling

try {
    Path.of(rulesPath.trim());
} catch (InvalidPathException e) {
    throw new IllegalArgumentException("fix the directed-inlining path: " + rulesPath, e);
}

Prevention

When it happens

Trigger: Setting the directed inlining command-file option (e.g., -Dgraal.DirectedInliningCommandFile=<value>) to a string containing illegal path characters (NUL byte, invalid characters on the OS) or a malformed path.

Common situations: Shell quoting mistakes that leave stray quotes/spaces in the flag; copying a Windows-style path onto Linux or vice versa; a template variable expanding to garbage.

Related errors


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