{"record":{"id":"15dd56bf0b116569","repo":"alibaba/spring-ai-alibaba","slug":"agent-schema-not-found-with-id-id","errorCode":null,"errorMessage":"Agent schema not found with id: ${id}","messagePattern":"Agent schema not found with id: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/base/service/impl/AgentSchemaServiceImpl.java","lineNumber":89,"sourceCode":"\t\tagentSchemaEntity.setEnabled(true);\n\t\tagentSchemaEntity.setGmtCreate(new Date());\n\t\tagentSchemaEntity.setGmtModified(new Date());\n\n\t\tString accountId = requestContext != null ? requestContext.getAccountId() : \"10000\";\n\t\tagentSchemaEntity.setCreator(accountId);\n\t\tagentSchemaEntity.setModifier(accountId);\n\n\t\tsave(agentSchemaEntity);\n\t\treturn agentSchemaEntity;\n\t}\n\n\t@Override\n\tpublic AgentSchemaEntity updateAgentSchema(AgentSchemaEntity agentSchemaEntity) {\n\t\tRequestContext requestContext = RequestContextHolder.getRequestContext();\n\n\t\tAgentSchemaEntity existing = getById(agentSchemaEntity.getId());\n\t\tif (existing == null) {\n\t\t\tthrow new IllegalArgumentException(\"Agent schema not found with id: \" + agentSchemaEntity.getId());\n\t\t}\n\n\t\t// Check for duplicate name in the same workspace (excluding current agent)\n\t\tString workspaceId = requestContext != null ? requestContext.getWorkspaceId() : null;\n\t\tif (StringUtils.isBlank(workspaceId)) {\n\t\t\tworkspaceId = \"1\"; // Use default workspace ID that matches database\n\t\t}\n\n\t\tLambdaQueryWrapper<AgentSchemaEntity> duplicateCheck = new LambdaQueryWrapper<>();\n\t\tduplicateCheck.eq(AgentSchemaEntity::getWorkspaceId, workspaceId);\n\t\tduplicateCheck.eq(AgentSchemaEntity::getName, agentSchemaEntity.getName());\n\t\tduplicateCheck.ne(AgentSchemaEntity::getId, agentSchemaEntity.getId()); // Exclude\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// current\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// agent\n\t\tList<AgentSchemaEntity> existingAgents = list(duplicateCheck);\n\n\t\tif (!existingAgents.isEmpty()) {\n\t\t\tthrow new IllegalArgumentException(\"智能体名称已存在，请使用其他名称: \" + agentSchemaEntity.getName());","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/base/service/impl/AgentSchemaServiceImpl.java#L71-L107","documentation":"Not-found guard raised in AgentSchemaServiceImpl.updateAgentSchema. The service loads the existing agent schema row by the id on the incoming entity before applying updates; if no row exists for that id (already deleted, wrong workspace, or a fabricated/stale id from the client), it throws a BizException because a nonexistent schema cannot be updated. Callers should treat this as a 404-style condition and refresh their agent list.","triggerScenarios":"Thrown at spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/base/service/impl/AgentSchemaServiceImpl.java:89 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the agent id from a fresh list query","Refresh the UI if the agent was deleted in another session","Return 404 to clients instead of retrying"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f82da0b50f35744c13968191be2b1cd2452ef550","analyzedAt":"2026-09-09T15:32:42.421Z","contentChangedAt":"2026-09-09T15:32:42.421Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}