theonedev/onedev · error · NotAcceptableException
Project not found:
Error message
Project not found:
What it means
RunProjectJobAction.execute resolves projectPath at runtime via ProjectService.findByPath to run a job in another project. If no project matches, it throws NotAcceptableException('Project not found: ' + projectPath), aborting the step.
Source
Thrown at server-core/src/main/java/io/onedev/server/buildspec/job/action/RunProjectJobAction.java:194
public String getAccessTokenSecret() {
return accessTokenSecret;
}
public void setAccessTokenSecret(String accessTokenSecret) {
this.accessTokenSecret = accessTokenSecret;
}
@SuppressWarnings("unused")
private static List<String> getAccessTokenSecretChoices() {
return Project.get().getHierarchyJobSecrets()
.stream().map(it->it.getName()).collect(Collectors.toList());
}
@Override
public void execute(Build build) {
Project project = getProjectService().findByPath(projectPath);
if (project == null)
throw new NotAcceptableException("Project not found: " + projectPath);
String secretValue = build.getJobAuthorizationContext().getSecretValue(accessTokenSecret);
var accessToken = getAccessTokenService().findByValue(secretValue);
if (accessToken == null)
throw new NotAcceptableException("Invalid access token");
var subject = accessToken.asSubject();
if (!SecurityUtils.canRunJob(subject, project, jobName))
throw new UnauthorizedException();
var user = SecurityUtils.getUser(subject);
ThreadContext.bind(subject);
try {
String refName;
if (branch != null) {
refName = GitUtils.branch2ref(branch);
} else if (tag != null) {
refName = GitUtils.tag2ref(tag);View on GitHub (pinned to d44925c47c)
Solutions
- Fix projectPath in the RunProjectJobAction to the exact full path of the target project.
- Update the action if the target project was renamed or moved.
- Verify the build's job authorization can see the target project (visibility/permission settings).
Example fix
// before projectPath: apps/frontend-web // after (project moved) projectPath: apps/web/frontend
Defensive patterns
Strategy: try-catch
Validate before calling
var target = OneDev.getInstance(ProjectService.class).findByPath(projectPath);
if (target == null) throw new IllegalArgumentException("Project not found: " + projectPath); Try / catch
try { runProjectJobAction.execute(build); } catch (NotAcceptableException e) { log.error("RunProjectJob failed: {}", e.getMessage()); } Prevention
- Use the project's exact full path from its URL.
- Update specs when projects are renamed or moved; audit for references first.
- Ensure job authorization context can resolve the target project.
When it happens
Trigger: Executing a RunProjectJobAction during a build where getProjectService().findByPath(projectPath) returns null — the referenced project path does not exist (or is invisible) when the action runs.
Common situations: Typo in projectPath; target project renamed/deleted between spec authoring and run; project moved under a different parent path; running the build spec on a different OneDev instance where the project doesn't exist.
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
- Unable to find project to import build spec: {0}
- Unable to find project '${projectPath}'
- Iteration '${iterationName}' not found
- Link spec not found: ${linkName}
- Pull request not found:
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/f34f2086dcc6256c.
Report an issue: GitHub.