{"record":{"id":"14af38b3e3553f1b","repo":"alibaba/nacos","slug":"20004-14af38","errorCode":"20004","errorMessage":"{type} not found: {name}","messagePattern":"(.+?) not found: (.+?)","errorType":"exception","errorClass":"NacosApiException","httpStatus":404,"severity":"error","filePath":"ai/src/main/java/com/alibaba/nacos/ai/service/resource/AiResourceManager.java","lineNumber":365,"sourceCode":"            AiResource latest = aiResourcePersistService.find(namespaceId, meta.getName(),\n                meta.getType());\n            if (latest == null || latest.getMetaVersion() == null) {\n                return;\n            }\n            expected = latest.getMetaVersion();\n        }\n    }\n    \n    // ---- 2.2 Query / validation helpers ----\n    \n    /**\n     * Load meta row or throw NOT_FOUND.\n     */\n    public AiResource requireMeta(String namespaceId, String name, String type)\n        throws NacosException {\n        AiResource meta = aiResourcePersistService.find(namespaceId, name, type);\n        if (meta == null) {\n            throw new NacosApiException(NacosException.NOT_FOUND, ErrorCode.RESOURCE_NOT_FOUND,\n                type + \" not found: \" + name);\n        }\n        return meta;\n    }\n    \n    /**\n     * Find meta row by namespace/name/type.\n     */\n    public AiResource findMeta(String namespaceId, String name, String type) {\n        return aiResourcePersistService.find(namespaceId, name, type);\n    }\n    \n    /**\n     * Find version row by namespace/name/type/version.\n     */\n    public AiResourceVersion findVersion(String namespaceId, String name, String type,\n        String version) {\n        return aiResourceVersionPersistService.find(namespaceId, name, type, version);","sourceCodeStart":347,"sourceCodeEnd":383,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/service/resource/AiResourceManager.java#L347-L383","documentation":"Thrown by the generic requireMeta helper in AiResourceManager when aiResourcePersistService.find returns null for the given namespace, name, and type. This is the shared NOT_FOUND guard used across all AI resource types (prompt, agent, skill, etc.). HTTP 404 RESOURCE_NOT_FOUND (code 20004). The message interpolates the resource type and name.","triggerScenarios":"Any AI resource operation that calls requireMeta with a name/type combination that has no metadata row. Common in agent, skill, MCP server, and A2A flows — not just prompts.","commonSituations":"Referencing a resource that was never created; namespace mismatch; resource was deleted; typo in the resource name; querying the wrong resource type (e.g. looking for a skill name in the agent type).","solutions":["Verify the resource name, type, and namespace against a list API before calling require-dependent operations.","Confirm the resource was created in the correct namespace.","If deleted, re-create the resource.","Double-check the type parameter matches the resource kind (prompt vs agent vs skill)."],"exampleFix":"// before\nAiResource meta = resourceManager.requireMeta(ns, \"my-agent\", \"prompt\"); // wrong type\n\n// after\nAiResource meta = resourceManager.requireMeta(ns, \"my-agent\", \"agent\");","handlingStrategy":"validation","validationCode":"// Check resource existence before require-dependent operations\nAiResource meta = resourceManager.findMeta(ns, name, type);\nif (meta == null) {\n    // resource does not exist — create or report\n    return;\n}","typeGuard":"boolean resourceExists = resourceManager.findMeta(ns, name, type) != null;","tryCatchPattern":"try {\n    AiResource meta = resourceManager.requireMeta(ns, name, type);\n} catch (NacosApiException e) {\n    if (e.getErrCode() == NacosException.NOT_FOUND) {\n        // resource not found — create it or return friendly error\n    }\n    throw e;\n}","preventionTips":["Verify resource name, type, and namespace against a list API before operations.","Double-check the type parameter (prompt, agent, skill, mcp-server, a2a-agent) matches the resource kind.","Automate resource creation in deployment scripts so downstream operations always find the meta."],"tags":["ai-registry","not-found","resource-manager","generic"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}