{"record":{"id":"fee51527e924c1aa","repo":"theonedev/onedev","slug":"upload-project-not-found-fee515","errorCode":null,"errorMessage":"Upload project not found: ","messagePattern":"Upload project not found: ","errorType":"http","errorClass":"NotFoundException","httpStatus":404,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/rest/resource/WorkerResource.java","lineNumber":366,"sourceCode":"\t\treturn workspaceService.getWorkspaceContext(token, false) != null;\n\t}\n\n\t@Path(\"workspace-user-data\")\n\t@PUT\n\tpublic Response notifyWorkspaceUserDataUploaded(\n\t\t\t@QueryParam(\"token\") String token,\n\t\t\t@QueryParam(\"key\") String key) {\n\t\tWorkspaceContext context = workspaceService.getWorkspaceContext(token, true);\n\t\tLong userId = context.getUserId();\n\t\tuserService.notifyWorkspaceDataUploaded(userId, key);\n\t\treturn Response.ok().build();\n\t}\n\t\n\tprivate Project getUploadProject(Project project, @Nullable String projectPath) {\n\t\tif (projectPath != null) {\n\t\t\tvar uploadProject = projectService.findByPath(projectPath);\n\t\t\tif (uploadProject == null)\n\t\t\t\tthrow new NotFoundException(\"Upload project not found: \" + projectPath);\n\t\t\treturn uploadProject;\n\t\t} else {\n\t\t\treturn project;\n\t\t}\n\t}\n\n\tprivate StreamingOutput downloadCache(Long projectId, String key, @Nullable String checksum, String path) {\n\t\treturn os -> {\n\t\t\tsessionService.closeSession();\n\t\t\ttry {\n\t\t\t\tvar cacheFindResult = cacheService.findCache(projectId, key, checksum, path);\n\t\t\t\tif (cacheFindResult != null)\n\t\t\t\t\tstreamCache(cacheFindResult, os);\n\t\t\t\telse\n\t\t\t\t\tos.write(CacheAvailability.NOT_FOUND.ordinal());\n\t\t\t} finally {\n\t\t\t\tsessionService.openSession();\n\t\t\t}","sourceCodeStart":348,"sourceCodeEnd":384,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/rest/resource/WorkerResource.java#L348-L384","documentation":"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.","triggerScenarios":"A CI agent (worker) calling uploadProject with an explicit project path that does not match any existing project hierarchy path.","commonSituations":"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.","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"],"exampleFix":"// before\nuploadProject(projectId, \"old-team/old-app\");\n// after\nuploadProject(projectId, \"team/app\"); // path verified against GET /projects","handlingStrategy":"validation","validationCode":"Project p = findProjectByPath(path); if (p == null) throw new IllegalArgumentException(\"unknown project path: \" + path);","typeGuard":null,"tryCatchPattern":"try { uploadProject(jobToken, path); } catch (NotFoundException e) { log.error(\"project path invalid: {}\", e.getMessage()); }","preventionTips":["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"],"tags":["rest-api","ci-agent","project-path"],"backgroundTag":"resource-not-found","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}