alibaba/spring-ai-alibaba · error · IllegalArgumentException
评测集不存在:
Error message
评测集不存在:
What it means
Not-found error in DatasetServiceImpl.update. The service loads the dataset by request.getDatasetId() before applying updates; when no dataset row matches that id it throws an error reporting the missing id, because a nonexistent dataset cannot be updated. Typically means the dataset was deleted or the client sent a stale/incorrect datasetId. Callers should treat it as a 404-style condition.
Source
Thrown at spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/service/impl/DatasetServiceImpl.java:134
DatasetVersionDO datasetVersionDO = datasetVersionMapper.selectLatestVersion(dataset.getId());
if(Objects.nonNull(datasetVersionDO)){
dataset.setDataCount(datasetVersionDO.getDataCount());
dataset.setLatestVersion(datasetVersionDO.getVersion());
dataset.setLatestVersionId(datasetVersionDO.getId());
}
return dataset;
}
@Override
public Dataset update(DatasetUpdateRequest request) {
log.info("更新评测集: {}", request);
DatasetDO existingDataset = datasetMapper.selectById(request.getDatasetId());
if (existingDataset == null) {
throw new IllegalArgumentException("评测集不存在: " + request.getDatasetId());
}
datasetMapper.update(request.getDatasetId(),request.getName(),request.getDescription());
existingDataset.setName(request.getName());
existingDataset.setDescription(request.getDescription());
return Dataset.fromDO(existingDataset);
}
@Override
@Transactional
public void deleteById(Long id) {
log.info("删除评测集: {}", id);
datasetMapper.deleteById(id);
log.info("评测集删除成功: {}", id);
}
View on GitHub (pinned to f82da0b50f)
Solutions
- Fetch the current dataset id via the list/get API before updating
- Confirm the dataset still exists (it may have been deleted by another user/job)
- Check you are passing datasetId, not a version or item id
- Verify the app connects to the environment where the dataset lives
Example fix
// before
DatasetUpdateRequest req = new DatasetUpdateRequest();
req.setDatasetId(42L); // deleted
datasetService.update(req);
// after
if (datasetService.getById(42L) == null) { throw new BusinessException("dataset 42 not found"); }
datasetService.update(req); Defensive patterns
Strategy: validation
Validate before calling
if (datasetService.getById(req.getDatasetId()) == null) { throw new BusinessException("dataset not found: " + req.getDatasetId()); } Type guard
boolean datasetExists(Long id) { return id != null && datasetService.getById(id) != null; } Try / catch
try { datasetService.update(req); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith("评测集不存在")) { refreshDatasetList(); } else { throw e; } } Prevention
- Re-fetch dataset ids before updates instead of using cached values
- Handle deletion by other users gracefully (refresh UI list)
- Use @Positive and existence checks in the controller layer
When it happens
Trigger: Calling update(DatasetUpdateRequest) with a datasetId that was deleted, never created, or from another environment/database.
Common situations: Stale dataset id in a long-lived client after deletion; swapping datasetId and itemId; wrong DB profile between dev and prod; hard-coded ids from an old test run.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
AI-assisted analysis of alibaba/spring-ai-alibaba@f82da0b50f (2026-09-09).
Data as JSON: /api/errors/b697aa2044868bc4.
Report an issue: GitHub.