theonedev/onedev · error · NotFoundException
Upload project not found:
Error message
Upload project not found:
What it means
WorkerResource.getUploadProject throws this NotFoundException during workspace upload handling when a projectPath is supplied but no project with that path exists in OneDev. When projectPath is null the job's own project is used; a non-null path means the job wants to upload into a different project, resolved via projectService.findByPath. A typo or a since-deleted/relocated project yields this 404.
Source
Thrown at server-core/src/main/java/io/onedev/server/rest/resource/WorkerResource.java:366
return workspaceService.getWorkspaceContext(token, false) != null;
}
@Path("workspace-user-data")
@PUT
public Response notifyWorkspaceUserDataUploaded(
@QueryParam("token") String token,
@QueryParam("key") String key) {
WorkspaceContext context = workspaceService.getWorkspaceContext(token, true);
Long userId = context.getUserId();
userService.notifyWorkspaceDataUploaded(userId, key);
return Response.ok().build();
}
private Project getUploadProject(Project project, @Nullable String projectPath) {
if (projectPath != null) {
var uploadProject = projectService.findByPath(projectPath);
if (uploadProject == null)
throw new NotFoundException("Upload project not found: " + projectPath);
return uploadProject;
} else {
return project;
}
}
private StreamingOutput downloadCache(Long projectId, String key, @Nullable String checksum, String path) {
return os -> {
sessionService.closeSession();
try {
var cacheFindResult = cacheService.findCache(projectId, key, checksum, path);
if (cacheFindResult != null)
streamCache(cacheFindResult, os);
else
os.write(CacheAvailability.NOT_FOUND.ordinal());
} finally {
sessionService.openSession();
}View on GitHub (pinned to d44925c47c)
Solutions
- Correct the projectPath in the job/workspace configuration to match the existing project's path exactly (case-sensitive)
- Check the project exists via the UI or GET /projects and use its current path
- If the upload should target the job's own project, omit/null the projectPath
Example fix
// before uploadProject(projectId, "old-team/old-app"); // after uploadProject(projectId, "team/app"); // path verified against GET /projects
Defensive patterns
Strategy: validation
Validate before calling
Project p = findProjectByPath(path); if (p == null) throw new IllegalArgumentException("unknown project path: " + path); Try / catch
try { uploadProject(jobToken, path); } catch (NotFoundException e) { log.error("project path invalid: {}", e.getMessage()); } Prevention
- Resolve project paths dynamically from the API rather than hardcoding
- Re-validate paths after project renames/moves
- Omit projectPath when uploading to the job's own project
When it happens
Trigger: A CI agent (worker) calling uploadProject with an explicit project path that does not match any existing project hierarchy path.
Common situations: Project renamed or moved in the tree after the job's config was written; typo in the project path in a job/workspace spec; project deleted before queued jobs ran.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Project not found: ${projectPath}
- ${e.getMessage()}
- Reviewer not found:
- Assignee not found:
- Not authenticated
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/fee51527e924c1aa.
Report an issue: GitHub.