{"record":{"id":"008f2d164932695f","repo":"theonedev/onedev","slug":"project-not-found-projectpath","errorCode":null,"errorMessage":"Project not found: ${projectPath}","messagePattern":"Project not found: (.+?)","errorType":"http","errorClass":"NotAcceptableException","httpStatus":406,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/rest/resource/TriggerJobResource.java","lineNumber":102,"sourceCode":"    }\n\t\n\t@Api(order=100, description=DESCRIPTION)\n\t@POST\n    public Long triggerJobViaPost(\n    \t\t@Api(description=\"Path of the project\") @QueryParam(PARAM_PROJECT) @NotEmpty String projectPath, \n    \t\t@Api(description=REF_DESCRIPTION) @QueryParam(PARAM_BRANCH) @Nullable String branch, \n    \t\t@Api(description=REF_DESCRIPTION) @QueryParam(PARAM_TAG) @Nullable String tag, \n    \t\t@QueryParam(PARAM_JOB) @NotEmpty String job,\n\t\t\t@Api(description=ACCESS_TOKEN_DESCRIPTION) @QueryParam(PARAM_ACCESS_TOKEN) @NotEmpty String accessToken, \n    \t\t@Context UriInfo uriInfo) {\n\t\treturn triggerJob(projectPath, branch, tag, job, accessToken, uriInfo);\n    }\n\n    private Long triggerJob(String projectPath, @Nullable String branch, @Nullable String tag, String job,\n\t\t\t\t\t\t\tString accessTokenValue, UriInfo uriInfo) {\n\t\tProject project = projectService.findByPath(projectPath);\n\t\tif (project == null)\n\t\t\tthrow new NotAcceptableException(\"Project not found: \" + projectPath);\n\n\t\tvar accessToken = accessTokenService.findByValue(accessTokenValue);\n\t\tif (accessToken == null)\n\t\t\tthrow new NotAcceptableException(\"Invalid access token\");\n\t\t\n\t\tvar subject = accessToken.asSubject();\n\t\tvar user = SecurityUtils.getUser(subject);\n\t\tThreadContext.bind(subject);\n\t\ttry {\n\t\t\tif (!SecurityUtils.canRunJob(subject, project, job))\t\t\n\t\t\t\tthrow new UnauthorizedException();\n\n\t\t\tif (StringUtils.isNotBlank(branch) && StringUtils.isNotBlank(tag)) \n\t\t\t\tthrow new NotAcceptableException(\"Either branch or tag should be specified, but not both\");\n\t\t\t\n\t\t\tString refName;\n\t\t\tif (branch != null)\n\t\t\t\trefName = GitUtils.branch2ref(branch);","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/rest/resource/TriggerJobResource.java#L84-L120","documentation":"The job trigger endpoint (/~api/trigger-job?project=...) resolves the project via projectService.findByPath(projectPath). If no project matches the given path, NotAcceptableException (406) with 'Project not found: <path>' is thrown. The project path is the URL-ish path of the project (e.g. 'myorg/myrepo' or '~user/project').","triggerScenarios":"GET/POST trigger-job with 'project' query parameter not matching any existing project path, including typos, wrong case, missing parent path, or a path of a deleted/archived project.","commonSituations":"Renaming or moving a project without updating CI scripts; using repo slug instead of full path; trailing/leading whitespace or wrong URL encoding; project deleted before the trigger ran.","solutions":["Check the project path in OneDev UI and pass the exact path in the 'project' parameter.","Include the parent hierarchy in the path (e.g. 'group/sub/project'), not just the last segment.","Confirm the project is not renamed/deleted and update the calling script accordingly."],"exampleFix":"// before\ncurl 'http://onedev/~api/trigger-job?project=myrepo&job=CI&access_token=...'\n// after (use full path, URL-encoded)\ncurl 'http://onedev/~api/trigger-job?project=myorg%2Fmyrepo&job=CI&access_token=...'","handlingStrategy":"validation","validationCode":"const project = await fetch(`/~api/projects?path=${encodeURIComponent(projectPath)}`, {headers: {Authorization: auth}}).then(r => r.json());\nif (!project) throw new Error(`Project not found: ${projectPath}`);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Store full project paths in CI variables, not just slugs.","URL-encode the path parameter.","Update scripts when projects are renamed or moved."],"tags":["rest-api","project-path","ci-cd","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-14T00:17:10.932Z"}