oracle/graal · error · ValueError

the relative home path of {language} is already set to {self

Error message

the relative home path of {language} is already set to {self.relative_home_paths[language]} and cannot also be set to {path} for {self.destination}

What it means

While building a GraalVM image layout, add_relative_home_path() records where each language's home directory lives relative to the image. A language may only have one relative home path per destination; registering a second, different path raises ValueError to surface a suite configuration conflict.

Source

Thrown at sdk/mx.sdk/mx_sdk_vm.py:140

        for required in required_exports:
            target_modules = required_exports[required]
            target_modules_str = custom_target_module_str or ','.join(sorted(target_module.name for target_module in target_modules))
            required_module_name, required_package_name = required
            add_exports.append('--add-exports=' + required_module_name + '/' + required_package_name + "=" + target_modules_str)
        return sorted(add_exports)

    def get_add_exports(self, missing_jars):
        if self.use_modules is None:
            return ''
        distributions = self.jar_distributions
        distributions_transitive = mx.classpath_entries(distributions)
        distributions_transitive_clean = [entry for entry in distributions_transitive if str(entry) not in missing_jars]
        required_exports = mx_javamodules.requiredExports(distributions_transitive_clean, base_jdk())
        return AbstractNativeImageConfig.get_add_exports_list(required_exports)

    def add_relative_home_path(self, language, path):
        if language in self.relative_home_paths and self.relative_home_paths[language] != path:
            raise ValueError(f'the relative home path of {language} is already set to {self.relative_home_paths[language]} and cannot also be set to {path} for {self.destination}')
        self.relative_home_paths[language] = path

    def add_relative_extracted_lib_path(self, name, path):
        if name in self.relative_extracted_lib_paths and self.relative_extracted_lib_paths[name] != path:
            raise ValueError(f'the relative extracted lib path of {name} is already set to {self.relative_extracted_lib_paths[name]} and cannot also be set to {path} for {self.destination}')
        self.relative_extracted_lib_paths[name] = path

class LauncherConfig(AbstractNativeImageConfig):
    def __init__(self, destination, jar_distributions, main_class, build_args, is_main_launcher=True,
                 default_symlinks=True, is_sdk_launcher=False, custom_launcher_script=None, extra_jvm_args=None,
                 use_modules=None, main_module=None, link_at_build_time=True, option_vars=None, home_finder=True, **kwargs):
        """
        :param str main_class
        :param bool is_main_launcher
        :param bool default_symlinks
        :param bool is_sdk_launcher: Whether it uses org.graalvm.launcher.Launcher
        :param str custom_launcher_script: Custom launcher script, to be used when not compiled as a native image
        :param list[str] | None extra_jvm_args

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Inspect the message for both paths, find the two components registering the language, and make them agree (same path) in suite.py.
  2. If two distinct homes are genuinely needed, give the second one a different language key or destination.
  3. Re-run the layout build after fixing to confirm the conflict is gone.

Example fix

# before (suite.py)
component A: add_relative_home_path('python', 'languages/python')
component B: add_relative_home_path('python', 'python')   # conflict

# after
component B: add_relative_home_path('python', 'languages/python')
Defensive patterns

Strategy: validation

Validate before calling

def add_relative_home_path_checked(cfg, language, path):
    existing = cfg.relative_home_paths.get(language)
    if existing is not None and existing != path:
        raise ValueError(f"{language} home already {existing}; refusing to set {path}")
    cfg.relative_home_paths[language] = path

Prevention

When it happens

Trigger: Two components/suite.py entries calling add_relative_home_path('language-X', p1) and add_relative_home_path('language-X', p2) with p1 != p2 for the same image destination.

Common situations: Editing suite.py to relocate a language home; adding a new language that reuses an existing language key; copying a component config and forgetting to change the language name.

Related errors


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