oracle/graal · error · ValueError

Unknown component: {name}

Error message

Unknown component: {name}

What it means

Central component registry lookup in mx_sdk_vm.py: graalvm_component_by_name() checks both the internal _graalvm_components dict and the by-name alias dict; if the name appears in neither and fatalIfMissing is true (the default), ValueError 'Unknown component: <name>' is raised.

Source

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

            _log_ignored_component(component, _prev)
        else:
            _log_ignored_component(_prev, component)
    else:
        _graalvm_components[component.short_name] = component
        _graalvm_components_by_name[component.name] = component


def graalvm_component_by_name(name, fatalIfMissing=True):
    """
    :rtype: GraalVmComponent
    """
    if name in _graalvm_components:
        return _graalvm_components[name]
    elif name in _graalvm_components_by_name:
        return _graalvm_components_by_name[name]
    else:
        if fatalIfMissing:
            raise ValueError(f"Unknown component: {name}")
        return None

def graalvm_components(opt_limit_to_suite=False):
    """
    :rtype: list[GraalVmComponent]
    """
    if opt_limit_to_suite and mx.get_opts().specific_suites:
        return [c for c in _graalvm_components.values() if c.suite.name in mx.get_opts().specific_suites]
    else:
        return list(_graalvm_components.values())


def graalvm_home(fatalIfMissing=False):
    import mx_sdk_vm_impl
    return mx_sdk_vm_impl.graalvm_home(fatalIfMissing=fatalIfMissing)


def add_graalvm_hostvm_config(name, java_args=None, launcher_args=None, priority=0):

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Fix the name: check the exact registered names by listing _graalvm_components (or the suite.py component declarations) and correct the typo.
  2. If the component should exist, ensure the suite that declares it is loaded (remove it from --suite exclusions, run mx primary suite-wide).
  3. Call graalvm_component_by_name(name, fatalIfMissing=False) where absence is an expected case, to get None instead of an exception.

Example fix

# before
comp = graalvm_component_by_name('graaljs')   # actual name differs -> ValueError

# after
comp = graalvm_component_by_name('graalvm-js')
Defensive patterns

Strategy: type-guard

Validate before calling

def resolve_component(name):
    return graalvm_component_by_name(name, fatalIfMissing=False)  # None instead of raise

if resolve_component(cfg_name) is None:
    # typo, unloaded suite, or removed component: fail with context
    raise SystemExit(f"unknown GraalVM component '{name}'; check suite.py registrations")

Type guard

def is_known_component(name) -> bool:
    return graalvm_component_by_name(name, fatalIfMissing=False) is not None

Try / catch

try:
    comp = graalvm_component_by_name(name)
except ValueError as e:
    if 'Unknown component' in str(e):
        # surface registered names / fix the typo, then retry
        raise

Prevention

When it happens

Trigger: Any code resolving a component name that was never registered via the suite.py component declarations - typos in deps, layout entries, or command-line component selectors.

Common situations: Suite.py refactors that rename components; running with restricted suites so registration never happened; stale caches referencing old names.

Related errors


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