alibaba/nacos · error · IllegalStateException

No AiResourceStorage for provider: + storageKey.getProvider

Error message

No AiResourceStorage for provider:  + storageKey.getProvider()

What it means

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.

Source

Thrown at plugin/ai/src/main/java/com/alibaba/nacos/plugin/ai/storage/AiResourceStorageRouter.java:85

    
    /**
     * Route to storage implementation by {@link StorageKey#getProvider()}.
     *
     * @param storageKey storage key
     * @return storage implementation
     */
    public AiResourceStorage route(StorageKey storageKey) {
        if (storageKey == null || StringUtils.isBlank(storageKey.getProvider())) {
            throw new IllegalArgumentException("StorageKey.provider is blank");
        }
        if (!PluginStateCheckerHolder.isPluginEnabled(PluginType.AI_STORAGE.getType(),
            storageKey.getProvider())) {
            throw new IllegalStateException(
                "AiResourceStorage plugin is disabled: " + storageKey.getProvider());
        }
        AiResourceStorage storage = STORAGES_BY_TYPE.get(storageKey.getProvider());
        if (storage == null) {
            throw new IllegalStateException(
                "No AiResourceStorage for provider: " + storageKey.getProvider());
        }
        return storage;
    }
    
    public Map<String, AiResourceStorage> allStorages() {
        return Collections.unmodifiableMap(STORAGES_BY_TYPE);
    }
    
    /**
     * Register a storage implementation at runtime using first-wins semantics.
     *
     * <p>Mainly for tests or embedding scenarios. A duplicate type is ignored with a warning.</p>
     *
     * @param storage storage implementation
     * @return true if storage is joined
     */
    public static synchronized boolean join(AiResourceStorage storage) {

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Install the AI storage plugin JAR providing an AiResourceStorage implementation for the provider.
  2. Confirm STORAGES_BY_TYPE contains the provider key after startup.
  3. Use a provider that has a registered storage implementation, or register one via SPI.

Example fix

// before: no storage impl for provider
router.route(new StorageKey("unknownProvider")); // -> IllegalStateException no storage

// after: install/register an AiResourceStorage for the provider
// public class MyProviderAiStorage implements AiResourceStorage { ... }
// META-INF/services registration
router.route(new StorageKey("myProvider"));
Defensive patterns

Strategy: try-catch

Validate before calling

boolean hasStorage = router.allStorages().containsKey(storageKey.getProvider());
if (!hasStorage) {
    // install/register an AiResourceStorage for the provider
}

Type guard

static boolean aiStorageRegistered(AiResourceStorageRouter r, String provider) {
    return provider != null && r.allStorages().containsKey(provider);
}

Try / catch

try {
    return router.route(key);
} catch (IllegalStateException e) {
    if (e.getMessage().startsWith("No AiResourceStorage for provider")) {
        // install provider storage plugin and retry
    } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14). Data as JSON: /api/errors/7ae1c75ca42c6412. Report an issue: GitHub.