{"record":{"id":"0b3d65e98873f7bf","repo":"alibaba/nacos","slug":"resource-not-found-0b3d65","errorCode":"RESOURCE_NOT_FOUND","errorMessage":"AI resource import operator not found: {}","messagePattern":"AI resource import operator not found: (.+?)","errorType":"exception","errorClass":"NacosApiException","httpStatus":404,"severity":"error","filePath":"ai/src/main/java/com/alibaba/nacos/ai/importer/operator/AiResourceOperatorRegistry.java","lineNumber":66,"sourceCode":"                throw new IllegalStateException(\n                    \"Duplicate AI resource import operator type: \" + each.resourceType());\n            }\n            loadedOperators.put(each.resourceType(), each);\n        }\n        this.operators = Collections.unmodifiableMap(loadedOperators);\n    }\n    \n    /**\n     * Resolve the operator for a resource type.\n     *\n     * @param resourceType resource type\n     * @return resource operator\n     * @throws NacosException if no operator is registered\n     */\n    public AiResourceOperator getOperator(String resourceType) throws NacosException {\n        AiResourceOperator operator = operators.get(resourceType);\n        if (operator == null) {\n            throw new NacosApiException(NacosException.NOT_FOUND, ErrorCode.RESOURCE_NOT_FOUND,\n                \"AI resource import operator not found: \" + resourceType);\n        }\n        return operator;\n    }\n    \n    /**\n     * Whether an operator exists for the resource type.\n     *\n     * @param resourceType resource type\n     * @return true if an operator exists\n     */\n    public boolean hasOperator(String resourceType) {\n        return operators.containsKey(resourceType);\n    }\n}\n","sourceCodeStart":48,"sourceCodeEnd":82,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/importer/operator/AiResourceOperatorRegistry.java#L48-L82","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Register an AiResourceOperator Spring bean whose resourceType() matches the artifact type returned by the source.","Check server startup logs for 'Duplicate AI resource import operator type' or 'operator type is empty' IllegalStateExceptions that would have prevented registration.","Use AiResourceOperatorRegistry.hasOperator(type) to pre-screen artifacts before calling getOperator."],"exampleFix":"// before: no operator for \"prompt\" artifacts -> validate/execute fails\n\n// after: register a bean\n@Component\npublic class PromptImportOperator implements AiResourceOperator {\n    public String resourceType() { return \"prompt\"; }\n    // ... validate(...) and importResource(...) ...\n}","handlingStrategy":"validation","validationCode":"String type = artifact.getResourceType();\nif (!operatorRegistry.hasOperator(type)) {\n    throw new IllegalStateException(\n        \"No AiResourceOperator registered for resourceType '\" + type\n        + \"'; cannot import this artifact.\");\n}\noperatorRegistry.getOperator(type);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use AiResourceOperatorRegistry.hasOperator(type) to pre-screen artifacts before validate/execute.","Register an AiResourceOperator bean for every resourceType a plugin advertises in supportedResourceTypes().","Watch startup logs for duplicate/empty operator IllegalStateExceptions that silently block registration."],"tags":["ai","importer","operator","not-found","server-error"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}