{"record":{"id":"b6b6f79fe0d5a6f7","repo":"theonedev/onedev","slug":"project-not-specified","errorCode":null,"errorMessage":"Project not specified","messagePattern":"Project not specified","errorType":"exception","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/git/GitFilter.java","lineNumber":101,"sourceCode":"\t\tthis.workExecutionService = workExecutionService;\n\t\tthis.sessionService = sessionService;\n\t\tthis.clusterService = clusterService;\n\t\tthis.codePullAuthorizationSources = codePullAuthorizationSources;\n\t}\n\t\n\tprivate String getPathInfo(HttpServletRequest request) {\n\t\tString pathInfo = request.getRequestURI().substring(request.getContextPath().length());\n\t\treturn StringUtils.stripStart(pathInfo, \"/\");\n\t}\n\t\n\tprivate Long getProjectId(String projectPath, boolean clusterAccess, boolean upload) {\n\t\tvar facade = projectService.findFacadeByPath(projectPath);\n\t\tif (facade == null && projectPath.endsWith(\".git\")) {\n\t\t\tprojectPath = StringUtils.substringBeforeLast(projectPath, \".\");\n\t\t\tfacade = projectService.findFacadeByPath(projectPath);\n\t\t}\n\t\tif (StringUtils.isBlank(projectPath))\n\t\t\tthrow new ExplicitException(\"Project not specified\");\n\t\tif (facade == null) \n\t\t\treportProjectNotFoundOrInaccessible(projectPath);\n\t\treturn facade.getId();\n\t}\n\n\tprivate void reportProjectNotFoundOrInaccessible(String projectPath) {\n\t\tif (SecurityUtils.getUser() != null)\n\t\t\tthrow new EntityNotFoundException(\"Project not found or inaccessible: \" + projectPath);\n\t\telse\n\t\t\tthrow new UnauthorizedException(\"Authentication required\");\n\t}\n\n\tprivate void doNotCache(HttpServletResponse response) {\n\t\tresponse.setHeader(\"Expires\", \"Fri, 01 Jan 1980 00:00:00 GMT\");\n\t\tresponse.setHeader(\"Pragma\", \"no-cache\");\n\t\tresponse.setHeader(\"Cache-Control\", \"no-cache, max-age=0, must-revalidate\");\n\t}\n","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/git/GitFilter.java#L83-L119","documentation":"GitFilter resolves the project from the Git URL path before serving git HTTP requests (clone/fetch/push). When the extracted project path is blank — meaning the request URL did not contain any project path at all — it throws this ExplicitException instead of attempting a lookup. It signals a malformed request rather than a missing project.","triggerScenarios":"Calling any git smart-HTTP endpoint (info/refs, git-upload-pack, git-receive-pack) with a pathInfo from which getProjectId cannot extract a project path, so StringUtils.isBlank(projectPath) is true. Note the blank check happens after the .git-suffix stripping, so even the original path was empty.","commonSituations":"Hitting the bare /git or repository root endpoint directly in a browser or curl without a project path; misconfigured reverse-proxy rewrites that drop the path segment; broken CI scripts that build the clone URL with an empty project variable; copy-pasting a URL missing the project portion (e.g. https://server/git instead of https://server/git/myproject).","solutions":["Check the git remote URL / request URL and ensure it includes the full project path, e.g. git clone https://server/myproject.git","If behind a reverse proxy, verify proxy rewrite rules do not strip the project path segment","Fix the CI/script variable that generates the URL so it is not empty","Reproduce the request manually with curl to confirm the path segment is present"],"exampleFix":"// before\ngit clone https://onedev.example.com/git\n\n// after\ngit clone https://onedev.example.com/git/myproject.git","handlingStrategy":"validation","validationCode":"const projectPath = new URL(remoteUrl).pathname.replace(/^\\/git\\//, '').replace(/\\.git$/, '');\nif (!projectPath) throw new Error('Remote URL must include a project path, e.g. /git/myproject.git');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always build clone URLs from a template that includes the project path","Validate remote URLs with a regex requiring a non-empty project segment before invoking git","Check CI variables used in URLs are non-empty before running git commands"],"tags":["git","http","url-validation","onedev"],"backgroundTag":"missing-required-argument","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"}