alibaba/nacos · error · NacosApiException

RESOURCE_NOT_FOUND

RESOURCE_NOT_FOUND

Error message

AI resource import operator not found: {}

What it means

Thrown by AiResourceOperatorRegistry.getOperator() when no AiResourceOperator Spring bean is registered for the given resourceType. Operators handle validation and import of fetched artifacts; this fires during validateItem/executeItem after a plugin returns an artifact whose resourceType has no handler. Mapped to RESOURCE_NOT_FOUND with a NOT_FOUND top-level code. A hasOperator(resourceType) pre-check exists to avoid the throw.

Source

Thrown at ai/src/main/java/com/alibaba/nacos/ai/importer/operator/AiResourceOperatorRegistry.java:66

                throw new IllegalStateException(
                    "Duplicate AI resource import operator type: " + each.resourceType());
            }
            loadedOperators.put(each.resourceType(), each);
        }
        this.operators = Collections.unmodifiableMap(loadedOperators);
    }
    
    /**
     * Resolve the operator for a resource type.
     *
     * @param resourceType resource type
     * @return resource operator
     * @throws NacosException if no operator is registered
     */
    public AiResourceOperator getOperator(String resourceType) throws NacosException {
        AiResourceOperator operator = operators.get(resourceType);
        if (operator == null) {
            throw new NacosApiException(NacosException.NOT_FOUND, ErrorCode.RESOURCE_NOT_FOUND,
                "AI resource import operator not found: " + resourceType);
        }
        return operator;
    }
    
    /**
     * Whether an operator exists for the resource type.
     *
     * @param resourceType resource type
     * @return true if an operator exists
     */
    public boolean hasOperator(String resourceType) {
        return operators.containsKey(resourceType);
    }
}

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Register an AiResourceOperator Spring bean whose resourceType() matches the artifact type returned by the source.
  2. Check server startup logs for 'Duplicate AI resource import operator type' or 'operator type is empty' IllegalStateExceptions that would have prevented registration.
  3. Use AiResourceOperatorRegistry.hasOperator(type) to pre-screen artifacts before calling getOperator.

Example fix

// before: no operator for "prompt" artifacts -> validate/execute fails

// after: register a bean
@Component
public class PromptImportOperator implements AiResourceOperator {
    public String resourceType() { return "prompt"; }
    // ... validate(...) and importResource(...) ...
}
Defensive patterns

Strategy: validation

Validate before calling

String type = artifact.getResourceType();
if (!operatorRegistry.hasOperator(type)) {
    throw new IllegalStateException(
        "No AiResourceOperator registered for resourceType '" + type
        + "'; cannot import this artifact.");
}
operatorRegistry.getOperator(type);

Prevention

When it happens

Trigger: An import validate or execute flow where importer.fetch() returns an AiResourceImportArtifact whose resourceType does not match any registered AiResourceOperator bean. The artifact came from the external source, so the type is data-driven, not request-driven.

Common situations: An external source returns an artifact type the server has no operator for (e.g. a new resource kind); the operator bean failed to load at startup because of a duplicate-type IllegalStateException; a plugin advertises a resourceType in supportedResourceTypes but no matching AiResourceOperator bean exists.

Related errors


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