{"record":{"id":"3ab140477ce1fbf0","repo":"apache/shardingsphere","slug":"spi-1","errorCode":"SPI:1","errorMessage":"No implementation class load from SPI '%s' with type '%s'.","messagePattern":"No implementation class load from SPI '(.+?)' with type '(.+?)'\\.","errorType":"exception","errorClass":"ServiceProviderNotFoundException","httpStatus":null,"severity":"error","filePath":"infra/spi/src/main/java/org/apache/shardingsphere/infra/spi/type/typed/TypedSPILoader.java","lineNumber":129,"sourceCode":"    }\n    \n    /**\n     * Check service.\n     *\n     * @param serviceInterface typed SPI service interface\n     * @param type type\n     * @param props properties\n     * @param <T> SPI class type\n     * @throws ServiceProviderNotFoundException service provider not found server exception\n     */\n    public static <T extends TypedSPI> void checkService(final Class<T> serviceInterface, final Object type, final Properties props) {\n        for (T each : ShardingSphereServiceLoader.getServiceInstances(serviceInterface)) {\n            if (matchesType(type, each)) {\n                each.init(null == props ? new Properties() : convertToStringTypedProperties(props));\n                return;\n            }\n        }\n        throw new ServiceProviderNotFoundException(serviceInterface, type);\n    }\n    \n    private static boolean matchesType(final Object type, final TypedSPI instance) {\n        Object instanceType = instance.getType();\n        if (null == instanceType) {\n            return false;\n        }\n        if (instanceType instanceof String && type instanceof String) {\n            return instanceType.toString().equalsIgnoreCase(type.toString()) || instance.getTypeAliases().contains(type);\n        }\n        return instanceType.equals(type) || instance.getTypeAliases().contains(type);\n    }\n}\n","sourceCodeStart":111,"sourceCodeEnd":143,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/infra/spi/src/main/java/org/apache/shardingsphere/infra/spi/type/typed/TypedSPILoader.java#L111-L143","documentation":"TypedSPILoader.checkService iterates all implementations of a TypedSPI interface registered via ShardingSphereServiceLoader and matches the requested type (case-insensitively for strings, including type aliases). If no registered instance matches, it throws ServiceProviderNotFoundException ('No implementation class load from SPI ... with type ...', error code SPI:1) — the requested algorithm/dialect/feature type simply is not on the classpath or does not exist.","triggerScenarios":"Configuring a sharding/encryption key-generate algorithm, database dialect, or other TypedSPI extension with a type string that no registered implementation exposes — typos ('CLS_MOD' vs 'CLASS_BASED'), missing module/dependency jar, or a custom implementation lacking the META-INF/services registration or expected getType() value.","commonSituations":"Custom algorithm classes shipped without SPI registration files; dropping a dialect or feature module from the proxy distribution; renaming types between ShardingSphere versions; case/alias mismatches in YAML rule configuration.","solutions":["Fix the type value in configuration to exactly match the implementation's getType() (or one of its getTypeAliases()); string types match case-insensitively.","Add the module/jar containing the implementation and its META-INF/services/<SPI interface> registration file to the classpath.","For custom implementations, ensure the provider file names the class and getType() returns the configured value."],"exampleFix":"# before (custom SPI not registered)\n# src/main/resources/META-INF/services missing\nalgorithm: custom-hash: type: MY_HASH\n\n# after\n# file src/main/resources/META-INF/services/org.apache.shardingsphere.sharding.spi.ShardingAlgorithm:\n#   com.example.MyHashShardingAlgorithm  (getType() returns \"MY_HASH\")","handlingStrategy":"validation","validationCode":"boolean registered = ShardingSphereServiceLoader.getServiceInstances(ShardingAlgorithm.class).stream()\n        .map(a -> ((TypedSPI) a).getType().toString())\n        .anyMatch(t -> t.equalsIgnoreCase(configuredType));\nif (!registered) { fail fast with the list of available types; }","typeGuard":null,"tryCatchPattern":"try { TypedSPILoader.checkService(iface, type, props); } catch (ServiceProviderNotFoundException e) { /* list available types, fix config or classpath */ }","preventionTips":["Validate algorithm/SPI type names against documentation or getType() at config load time.","Ship META-INF/services registration files with every custom SPI implementation.","Keep dialect/feature modules on the classpath; verify after dependency pruning."],"tags":["spi","classloading","configuration","algorithm"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}