OtterMind/Chat2DB · warning · DataNotFoundException
common.dataNotFound
common.dataNotFound
Error message
common.dataNotFound
What it means
DataNotFoundException ('common.dataNotFound') from TaskRecordServiceImpl.resolveDownload when the task lookup returns null or the task's downloadUrl is blank — there is nothing to download.
Source
Thrown at chat2db-community-server/chat2db-community-domain/chat2db-community-domain-core/src/main/java/ai/chat2db/community/domain/core/impl/task/TaskRecordServiceImpl.java:72
if (!taskSchedulerService.cancel(id)) {
Task task = getTask(id);
if (task == null || StringUtils.equalsAnyIgnoreCase(
task.getTaskStatus(), "FINISHED", STATUS_STOP, "ERROR")) {
return;
}
}
TaskRecordUpdateRequest request = new TaskRecordUpdateRequest();
request.setId(id);
request.setTaskStatus(STATUS_STOP);
request.setDownloadUrl("");
updateTask(request);
}
@Override
public TaskDownload resolveDownload(Long id, Long userId) {
Task task = getTask(id);
if (task == null || StringUtils.isBlank(task.getDownloadUrl())) {
throw new DataNotFoundException();
}
if (!Objects.equals(userId, task.getUserId())) {
throw new PermissionDeniedBusinessException();
}
File file = new File(task.getDownloadUrl());
if (!file.exists() || !file.canRead()) {
throw new DataNotFoundException();
}
return TaskDownload.builder()
.fileName(file.getName())
.fileUri(file.toURI().toString())
.build();
}
}
View on GitHub (pinned to 5ee1e990e7)
Solutions
- Confirm the task id exists and that the export has reached a completed status before resolving the download.
- If the task was stopped, re-trigger the export to regenerate downloadUrl.
- Validate id is non-null and present in task list before calling resolveDownload.
Defensive patterns
Strategy: validation
Validate before calling
Task t = getTask(id); if (t == null || StringUtils.isBlank(t.getDownloadUrl())) throw new DataNotFoundException();
Type guard
boolean isDownloadReady(Task t) { return t != null && StringUtils.isNotBlank(t.getDownloadUrl()); } Prevention
- Only resolve a download after the export task reaches a completed status.
- Re-trigger export if the task was stopped (stopTask blanks downloadUrl).
- Validate id presence in the task list first.
When it happens
Trigger: GET/resolve a task download by an id whose task does not exist, was never assigned a downloadUrl (export not finished / failed), or whose URL field was cleared (e.g. after STATUS_STOP reset).
Common situations: Polling a download URL before the export task has finished; task id mistyped; task cancelled (stopTask blanks the URL); export failed without producing a file.
Related errors
- common.permissionDenied
- ai.model.config.notFound
- datasource_not_found
- largeCellValue.downloadFailed
- datasource.not.found
AI-assisted analysis of OtterMind/Chat2DB@5ee1e990e7 (2026-08-14).
Data as JSON: /api/errors/f33d487f5495524b.
Report an issue: GitHub.