{"record":{"id":"e1fb2672fc00e946","repo":"apache/maven","slug":"no-instance-of-clazz-getname-is-bound-to-the","errorCode":null,"errorMessage":"No instance of ${clazz.getName()} is bound to the session scope.","messagePattern":"No instance of (.+?) is bound to the session scope\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"impl/maven-impl/src/main/java/org/apache/maven/impl/di/SessionScope.java","lineNumber":185,"sourceCode":"            return value;\n        }\n\n        @Override\n        public T get() {\n            if (value == null) {\n                synchronized (this) {\n                    if (value == null) {\n                        value = provider.get();\n                    }\n                }\n            }\n            return value;\n        }\n    }\n\n    public static <T> Supplier<T> seededKeySupplier(Class<? extends T> clazz) {\n        return () -> {\n            throw new IllegalStateException(\"No instance of \" + clazz.getName() + \" is bound to the session scope.\");\n        };\n    }\n}\n","sourceCodeStart":167,"sourceCodeEnd":189,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-impl/src/main/java/org/apache/maven/impl/di/SessionScope.java#L167-L189","documentation":"SessionScope.seededKeySupplier is the fallback supplier bound for session-scoped keys. When such a key is resolved and no real instance has been seeded or computed for the current session scope state, the supplier throws IllegalStateException(\"No instance of <class> is bound to the session scope.\") — the session scope holds no binding for that type.","triggerScenarios":"Resolving a session-scoped key before SessionScope.seed(...) provided the instance; bindings that reference the seeded key directly instead of going through the scope's scope() wrapper; resolving after exit() dropped the seeded values.","commonSituations":"Test setups binding a placeholder key but forgetting seed(); components depending on a session-scoped type that Maven never seeds in the current lifecycle phase; refactors renaming seeded classes so old keys remain bound to placeholders.","solutions":["Seed the instance before resolution: sessionScope.enter(); sessionScope.seed(MyComponent.class, instance);","Bind the type normally (unscoped or session-scoped with a real provider) instead of relying on the seeded placeholder key","Resolve the dependency lazily inside the session lifecycle, after Maven has seeded it"],"exampleFix":"// before\nsessionScope.enter();\nMyComponent c = injector.getInstance(MyComponent.class); // IllegalStateException: not seeded\n\n// after\nsessionScope.enter();\nsessionScope.seed(MyComponent.class, new MyComponentImpl());\nMyComponent c = injector.getInstance(MyComponent.class);","handlingStrategy":"validation","validationCode":"// seed the session scope before resolving the key\nsessionScope.enter();\ntry {\n    sessionScope.seed(MyComponent.class, new MyComponentImpl());\n    MyComponent c = injector.getInstance(MyComponent.class);\n} finally {\n    sessionScope.exit();\n}","typeGuard":null,"tryCatchPattern":"try {\n    MyComponent c = injector.getInstance(MyComponent.class);\n} catch (IllegalStateException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"session scope\")) {\n        throw new IllegalStateException(\"MyComponent must be seeded into the session scope first\", e);\n    }\n    throw e;\n}","preventionTips":["Bind session-scoped types with real providers instead of placeholder seeded keys","Seed required instances right after sessionScope.enter()","Prefer resolving dependencies during the session lifecycle, not at container startup"],"tags":["maven","di","sisu","scope","session","binding"],"backgroundTag":"di-scope-missing-binding","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}