{"record":{"id":"bb4054ba3e7517f9","repo":"oracle/graal","slug":"no-implementation-of-org-graalvm-home-homefinder-c","errorCode":null,"errorMessage":"No implementation of org.graalvm.home.HomeFinder could be found","messagePattern":"No implementation of org\\.graalvm\\.home\\.HomeFinder could be found","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"critical","filePath":"sdk/src/org.graalvm.home/src/org/graalvm/home/HomeFinder.java","lineNumber":116,"sourceCode":"            return ImageSingletons.lookup(HomeFinder.class);\n        } else {\n            HomeFinder finder = instance;\n            if (finder == null) {\n                Class<?> lookupClass = HomeFinder.class;\n                ModuleLayer moduleLayer = lookupClass.getModule().getLayer();\n                Iterable<HomeFinder> services;\n                if (moduleLayer != null) {\n                    services = ServiceLoader.load(moduleLayer, HomeFinder.class);\n                } else {\n                    services = ServiceLoader.load(HomeFinder.class, lookupClass.getClassLoader());\n                }\n                Iterator<HomeFinder> iterator = services.iterator();\n                if (!iterator.hasNext()) {\n                    services = ServiceLoader.load(HomeFinder.class);\n                    iterator = services.iterator();\n                }\n                if (!iterator.hasNext()) {\n                    throw new IllegalStateException(\"No implementation of \" + HomeFinder.class.getName() + \" could be found\");\n                }\n                finder = iterator.next();\n                instance = finder;\n            }\n            return finder;\n        }\n    }\n\n    private static volatile HomeFinder instance;\n}\n\nclass HomeFinderFeature implements Feature {\n\n    public String getURL() {\n        return \"https://github.com/oracle/graal/blob/master/sdk/src/org.graalvm.home/src/org/graalvm/home/HomeFinder.java\";\n    }\n\n    public String getDescription() {","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/sdk/src/org.graalvm.home/src/org/graalvm/home/HomeFinder.java#L98-L134","documentation":"org.graalvm.home.HomeFinder.get() locates a HomeFinder implementation via ServiceLoader (module layer, then class loader, then context class loader fallbacks). If no service provider registers org.graalvm.home.HomeFinder — normally supplied by the GraalVM launcher/runtime via META-INF/services or a Provides module directive — it throws IllegalStateException. The exception means the code is running outside a real GraalVM installation or with a classpath missing the home provider.","triggerScenarios":"Calling GraalVM.getVersion() / HomeFinder.get() from a plain JDK application whose classpath includes org.graalvm.home (e.g. via the SDK jar) but not the implementation that registers the HomeFinder service; running unit tests in Maven/Gradle without the GraalVM runtime; modular applications whose module layer does not include the provider module; broken or partial GraalVM installations.","commonSituations":"Compiling against graal-sdk/org.graalvm.home jars downloaded from Maven Central and running on a stock HotSpot JVM; polyglot/embedded contexts launched with a custom ClassLoader that cannot see the service file; CI test jobs that never install a full GraalVM; module path setups missing a 'requires' on the provider module.","solutions":["Run the application on an actual GraalVM distribution (JAVA_HOME pointed at it) so the launcher-provided HomeFinder service is visible.","If embedding on a stock JVM, add the implementation artifact that registers the HomeFinder service to the runtime classpath/module path (check META-INF/services/org.graalvm.home.HomeFinder or module Provides directive).","For custom/module-layer launches, ensure ServiceLoader.load(moduleLayer, HomeFinder.class) can see the provider: add it to the configuration and resolution roots.","For tests, inject or mock the HomeFinder/Version instead of relying on discovery, or set the lookup to skip HomeFinder in non-Graal environments."],"exampleFix":"// before\nVersion v = GraalVM.getVersion(); // plain JVM + sdk jar -> IllegalStateException\n\n// after\n// Run with GraalVM: JAVA_HOME=<graalvm-home> java -cp ... App\n// or guard:\nstatic Version safeVersion() {\n    try { return GraalVM.getVersion(); }\n    catch (IllegalStateException noHome) { return null; }\n}","handlingStrategy":"try-catch","validationCode":"static boolean isGraalHomeAvailable() {\n    try {\n        HomeFinder.get();\n        return true;\n    } catch (IllegalStateException e) {\n        return false;\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    Version v = GraalVM.getVersion();\n} catch (IllegalStateException e) {\n    // not running inside a GraalVM installation; degrade gracefully\n    log.warn(\"GraalVM home not found; version-dependent features disabled\");\n}","preventionTips":["Run production binaries on an actual GraalVM distribution.","Verify the HomeFinder service entry (META-INF/services or module Provides) is on the runtime class/module path when embedding.","In tests, inject or mock version info instead of relying on ServiceLoader discovery.","Set JAVA_HOME to the GraalVM install in CI jobs that exercise GraalVM-specific code."],"tags":["graalvm","service-loader","environment","home"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}