{"record":{"id":"7ae1c75ca42c6412","repo":"alibaba/nacos","slug":"no-airesourcestorage-for-provider-storagekey-g","errorCode":null,"errorMessage":"No AiResourceStorage for provider:  + storageKey.getProvider()","messagePattern":"No AiResourceStorage for provider:  \\+ storageKey\\.getProvider\\(\\)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"plugin/ai/src/main/java/com/alibaba/nacos/plugin/ai/storage/AiResourceStorageRouter.java","lineNumber":85,"sourceCode":"    \n    /**\n     * Route to storage implementation by {@link StorageKey#getProvider()}.\n     *\n     * @param storageKey storage key\n     * @return storage implementation\n     */\n    public AiResourceStorage route(StorageKey storageKey) {\n        if (storageKey == null || StringUtils.isBlank(storageKey.getProvider())) {\n            throw new IllegalArgumentException(\"StorageKey.provider is blank\");\n        }\n        if (!PluginStateCheckerHolder.isPluginEnabled(PluginType.AI_STORAGE.getType(),\n            storageKey.getProvider())) {\n            throw new IllegalStateException(\n                \"AiResourceStorage plugin is disabled: \" + storageKey.getProvider());\n        }\n        AiResourceStorage storage = STORAGES_BY_TYPE.get(storageKey.getProvider());\n        if (storage == null) {\n            throw new IllegalStateException(\n                \"No AiResourceStorage for provider: \" + storageKey.getProvider());\n        }\n        return storage;\n    }\n    \n    public Map<String, AiResourceStorage> allStorages() {\n        return Collections.unmodifiableMap(STORAGES_BY_TYPE);\n    }\n    \n    /**\n     * Register a storage implementation at runtime using first-wins semantics.\n     *\n     * <p>Mainly for tests or embedding scenarios. A duplicate type is ignored with a warning.</p>\n     *\n     * @param storage storage implementation\n     * @return true if storage is joined\n     */\n    public static synchronized boolean join(AiResourceStorage storage) {","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/plugin/ai/src/main/java/com/alibaba/nacos/plugin/ai/storage/AiResourceStorageRouter.java#L67-L103","documentation":"Thrown by AiResourceStorageRouter.route as IllegalStateException when STORAGES_BY_TYPE has no entry for the provider. The provider passed the blank-check and the plugin-state check, but no AiResourceStorage implementation was registered for it.","triggerScenarios":"Routing an AI resource storage operation to a provider for which no AiResourceStorage SPI implementation was loaded. Distinct from the disabled case: the plugin is enabled but the implementation is absent.","commonSituations":"Referencing a provider whose storage plugin JAR is missing; SPI registration broken; startup load skipped; provider typo that nonetheless passes the (lenient) plugin-state check.","solutions":["Install the AI storage plugin JAR providing an AiResourceStorage implementation for the provider.","Confirm STORAGES_BY_TYPE contains the provider key after startup.","Use a provider that has a registered storage implementation, or register one via SPI."],"exampleFix":"// before: no storage impl for provider\nrouter.route(new StorageKey(\"unknownProvider\")); // -> IllegalStateException no storage\n\n// after: install/register an AiResourceStorage for the provider\n// public class MyProviderAiStorage implements AiResourceStorage { ... }\n// META-INF/services registration\nrouter.route(new StorageKey(\"myProvider\"));","handlingStrategy":"try-catch","validationCode":"boolean hasStorage = router.allStorages().containsKey(storageKey.getProvider());\nif (!hasStorage) {\n    // install/register an AiResourceStorage for the provider\n}","typeGuard":"static boolean aiStorageRegistered(AiResourceStorageRouter r, String provider) {\n    return provider != null && r.allStorages().containsKey(provider);\n}","tryCatchPattern":"try {\n    return router.route(key);\n} catch (IllegalStateException e) {\n    if (e.getMessage().startsWith(\"No AiResourceStorage for provider\")) {\n        // install provider storage plugin and retry\n    } else throw e;\n}","preventionTips":["Install the AI storage plugin JAR providing an AiResourceStorage for the provider.","Confirm STORAGES_BY_TYPE contains the provider after startup.","Use a provider with a registered storage implementation."],"tags":["ai","storage","plugin","not-found","illegal-state"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}