alibaba/spring-ai-alibaba · error · IllegalArgumentException
Agent schema not found with id: ${id}
Error message
Agent schema not found with id: ${id} What it means
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.
Source
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
agentSchemaEntity.setEnabled(true);
agentSchemaEntity.setGmtCreate(new Date());
agentSchemaEntity.setGmtModified(new Date());
String accountId = requestContext != null ? requestContext.getAccountId() : "10000";
agentSchemaEntity.setCreator(accountId);
agentSchemaEntity.setModifier(accountId);
save(agentSchemaEntity);
return agentSchemaEntity;
}
@Override
public AgentSchemaEntity updateAgentSchema(AgentSchemaEntity agentSchemaEntity) {
RequestContext requestContext = RequestContextHolder.getRequestContext();
AgentSchemaEntity existing = getById(agentSchemaEntity.getId());
if (existing == null) {
throw new IllegalArgumentException("Agent schema not found with id: " + agentSchemaEntity.getId());
}
// Check for duplicate name in the same workspace (excluding current agent)
String workspaceId = requestContext != null ? requestContext.getWorkspaceId() : null;
if (StringUtils.isBlank(workspaceId)) {
workspaceId = "1"; // Use default workspace ID that matches database
}
LambdaQueryWrapper<AgentSchemaEntity> duplicateCheck = new LambdaQueryWrapper<>();
duplicateCheck.eq(AgentSchemaEntity::getWorkspaceId, workspaceId);
duplicateCheck.eq(AgentSchemaEntity::getName, agentSchemaEntity.getName());
duplicateCheck.ne(AgentSchemaEntity::getId, agentSchemaEntity.getId()); // Exclude
// current
// agent
List<AgentSchemaEntity> existingAgents = list(duplicateCheck);
if (!existingAgents.isEmpty()) {
throw new IllegalArgumentException("智能体名称已存在,请使用其他名称: " + agentSchemaEntity.getName());View on GitHub (pinned to f82da0b50f)
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
Defensive patterns
Strategy: validation
When it happens
Trigger: 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.
Common situations: See trigger scenarios.
AI-assisted analysis of alibaba/spring-ai-alibaba@f82da0b50f (2026-09-09).
Data as JSON: /api/errors/15dd56bf0b116569.
Report an issue: GitHub.