{"record":{"id":"189ac8073fea64fb","repo":"apache/dubbo","slug":"extensionloader-for-type-is-not-found","errorCode":null,"errorMessage":"ExtensionLoader for [${type}] is not found","messagePattern":"ExtensionLoader for \\[(.+?)\\] is not found","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"dubbo-common/src/main/java/org/apache/dubbo/common/extension/ExtensionAccessor.java","lineNumber":57,"sourceCode":"    default <T> T getAdaptiveExtension(Class<T> type) {\n        ExtensionLoader<T> extensionLoader = getExtensionLoader(type);\n        return extensionLoader != null ? extensionLoader.getAdaptiveExtension() : null;\n    }\n\n    default <T> T getDefaultExtension(Class<T> type) {\n        ExtensionLoader<T> extensionLoader = getExtensionLoader(type);\n        return extensionLoader != null ? extensionLoader.getDefaultExtension() : null;\n    }\n\n    default <T> List<T> getActivateExtensions(Class<T> type) {\n        ExtensionLoader<T> extensionLoader = getExtensionLoader(type);\n        return extensionLoader != null ? extensionLoader.getActivateExtensions() : Collections.emptyList();\n    }\n\n    default <T> T getFirstActivateExtension(Class<T> type) {\n        ExtensionLoader<T> extensionLoader = getExtensionLoader(type);\n        if (extensionLoader == null) {\n            throw new IllegalArgumentException(\"ExtensionLoader for [\" + type + \"] is not found\");\n        }\n        List<T> extensions = extensionLoader.getActivateExtensions();\n        if (extensions.isEmpty()) {\n            throw new IllegalArgumentException(\"No activate extensions for [\" + type + \"] found\");\n        }\n        return extensions.get(0);\n    }\n\n    default Set<String> getSupportedExtensions(Class<?> type) {\n        ExtensionLoader<?> extensionLoader = getExtensionLoader(type);\n        return extensionLoader != null ? extensionLoader.getSupportedExtensions() : Collections.emptySet();\n    }\n}\n","sourceCodeStart":39,"sourceCodeEnd":71,"githubUrl":"https://github.com/apache/dubbo/blob/3a3043227f5571d25eb2889de5bca22f2914843b/dubbo-common/src/main/java/org/apache/dubbo/common/extension/ExtensionAccessor.java#L39-L71","documentation":"Thrown by ExtensionAccessor.getFirstActivateExtension(type) when getExtensionLoader(type) returns null — meaning no ExtensionLoader is registered for the given type in the current ScopeModel's ExtensionDirector. This indicates the type is either not a Dubbo SPI interface or the extension director has not been initialized for it.","triggerScenarios":"Calling getFirstActivateExtension(SomeClass.class) where SomeClass is not a recognized SPI interface, or the ExtensionDirector for the current scope has no loader for that type. getExtensionLoader returns null (not throws) for unrecognized types, and getFirstActivateExtension then throws this IllegalArgumentException.","commonSituations":"Passing a non-SPI class (a plain POJO, a concrete implementation class, or a class without META-INF/dubbo SPI config) to getFirstActivateExtension. Also happens when calling on an ExtensionAccessor whose ExtensionDirector is from a different/unrelated ScopeModel.","solutions":["Verify the type is a Dubbo SPI interface (has corresponding META-INF/dubbo/ or META-INF/services/ extension config files).","Ensure you are calling on the correct ScopeModel's ExtensionAccessor (e.g. applicationModel.getExtensionDirector()).","If the type genuinely has no loader, use getSupportedExtensions(type) which returns an empty set instead of throwing."],"exampleFix":"// before\nT ext = scopeModel.getFirstActivateExtension(NonSpiClass.class);\n\n// after\nT ext = scopeModel.getFirstActivateExtension(RealSpiInterface.class);","handlingStrategy":"validation","validationCode":"ExtensionLoader<?> loader = scopeModel.getExtensionLoader(type);\nif (loader == null) {\n    // type is not a registered SPI — use fallback or getSupportedExtensions\n}","typeGuard":"static boolean isRegisteredSpi(ExtensionAccessor accessor, Class<?> type) {\n    return accessor.getExtensionLoader(type) != null;\n}","tryCatchPattern":"try {\n    return accessor.getFirstActivateExtension(type);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"is not found\")) {\n        return null; // or use getExtension(type, name)\n    } else throw e;\n}","preventionTips":["Verify the type is a Dubbo SPI interface with META-INF config before calling.","Call getSupportedExtensions(type) which returns empty instead of throwing.","Ensure you use the correct ScopeModel's ExtensionAccessor."],"tags":["spi","extension-loader","activate","scope-model"],"backgroundTag":null,"analyzedSha":"3a3043227f5571d25eb2889de5bca22f2914843b","analyzedAt":"2026-08-14T00:43:19.853Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}