{"record":{"id":"a01e04bddf3bc374","repo":"theonedev/onedev","slug":"storage-not-found-for-project-path","errorCode":null,"errorMessage":"Storage not found for project: ${path}","messagePattern":"Storage not found for project: (.+?)","errorType":"exception","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/model/Project.java","lineNumber":2048,"sourceCode":"\t\tBlob blob = getBlob(blobIdent, true);\n\t\tif (blob.getLfsPointer() != null) {\n\t\t\treturn new LfsObject(getId(), blob.getLfsPointer().getObjectId())\n\t\t\t\t\t.detectMediaType(blobIdent.getName());\n\t\t} else {\n\t\t\treturn blob.getMediaType();\n\t\t}\n\t}\n\t\n\t@Nullable\n\tpublic String getActiveServer(boolean mustExist) {\n\t\tif (activeServer == null) {\n\t\t\tactiveServer = Optional.fromNullable(\n\t\t\t\t\tgetProjectService().getActiveServer(getId(), false));\n\t\t}\n\t\tif (activeServer.isPresent())\n\t\t\treturn activeServer.get();\n\t\telse if (mustExist) \n\t\t\tthrow new ExplicitException(\"Storage not found for project: \" + getPath());\n\t\telse\n\t\t\treturn null;\n\t}\n\t\n\t@Nullable\n\tpublic String findExcludedAiReviewFiles() {\n\t\tProject current = this;\n\t\tdo {\n\t\t\tif (current.getAiSetting().getExcludedReviewFiles() != null)\n\t\t\t\treturn current.getAiSetting().getExcludedReviewFiles();\n\t\t\tcurrent = current.getParent();\n\t\t} while (current != null);\n\t\t\n\t\treturn null;\n\t}\n\t\n\tpublic String findCodeAnalysisFiles() {\n\t\tProject current = this;","sourceCodeStart":2030,"sourceCodeEnd":2066,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/model/Project.java#L2030-L2066","documentation":"OneDev throws this ExplicitException when a project's storage cannot be located on any active server. Project.getStorage() (or similar accessor) resolves the active server via ProjectService.getActiveServer(); if none is found and the caller demands existence (mustExist=true), it aborts with this message. It typically means the project's data directory is missing or the cluster state is inconsistent.","triggerScenarios":"Calling any project API that accesses storage (e.g. getStorage()) when getActiveServer(getId(), false) returns absent and mustExist=true — i.e. no server currently hosts the project's repository storage.","commonSituations":"Project directory deleted/moved on disk while DB record remains; after restoring a database backup without the corresponding storage directories; cluster node taken out of service without migrating storages; project path changes not reflected on disk.","solutions":["Verify the project's storage directory exists under the server's site storage dir (server product dir /projects/...) and restore it if missing","Check cluster/server status: ensure the server that hosts this project's storage is running and registered as active","Re-run OneDev's storage consistency check / re-import the project, or delete and recreate the project if data is unrecoverable","If the project was renamed or moved externally, revert the change and use OneDev's own project move/rename feature"],"exampleFix":"// before (accessing storage of a possibly missing project)\nbyte[] bytes = project.getStorage();\n// after\nvar storage = project.getStorage(false);\nif (storage == null) {\n    logger.warn(\"Storage missing for project \" + project.getPath());\n    return;\n}","handlingStrategy":"try-catch","validationCode":"// Java: check storage presence before access\nvar server = OneDev.getInstance(ProjectService.class).getActiveServer(project.getId(), false);\nif (server == null) { /* skip or restore storage */ }","typeGuard":"boolean hasStorage(Project p) {\n    return OneDev.getInstance(ProjectService.class).getActiveServer(p.getId(), false) != null;\n}","tryCatchPattern":"try {\n    var storage = project.getStorage();\n} catch (ExplicitException e) {\n    logger.error(\"Project storage missing: {}\", project.getPath(), e);\n}","preventionTips":["Never delete or move project directories on disk directly; use OneDev UI/CLI","Keep DB and storage backups in sync when restoring","Monitor cluster node health to avoid orphaned storages"],"tags":["storage","project","onedev"],"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-14T05:17:10.506Z"}