theonedev/onedev · error · ExplicitException
Unable to find project to import build spec: {0}
Error message
Unable to find project to import build spec: {0} What it means
Import.getProject resolves the import's projectPath to a Project via ProjectService.findByPath. If no project exists at that path, it throws an ExplicitException because the imported build spec cannot be located without a valid project.
Source
Thrown at server-core/src/main/java/io/onedev/server/buildspec/Import.java:247
}
}
} catch (Exception e) {
context.disableDefaultConstraintViolation();
String message = e.getMessage();
if (message == null) {
logger.error("Error validating build spec import", e);
message = _T("Failed to validate build spec import. Check server log for details");
}
context.buildConstraintViolationWithTemplate(message).addConstraintViolation();
return false;
}
}
public Project getProject() {
if (project == null) {
project = OneDev.getInstance(ProjectService.class).findByPath(projectPath);
if (project == null)
throw new ExplicitException(MessageFormat.format( _T("Unable to find project to import build spec: {0}"), projectPath));
}
return project;
}
public RevCommit getCommit() {
if (commit == null) {
commit = getProject().getRevCommit(revision, false);
if (commit == null) {
String errorMessage = MessageFormat.format(
_T("Unable to find commit to import build spec (import project: {0}, import revision: {1})"),
projectPath, revision);
throw new ExplicitException(errorMessage);
}
}
return commit;
}
}View on GitHub (pinned to d44925c47c)
Solutions
- Correct the `project` field in the import entry to the exact full path of an existing project.
- Check the project list for the current name — rename it back or update the import if the project was renamed/deleted.
- Verify permissions/visibility if the project exists but the current account cannot see it.
Example fix
// before imports: - project: Shared/Pipelines revision: main // after (exact existing path) imports: - project: shared/pipelines revision: main
Defensive patterns
Strategy: validation
Validate before calling
var project = OneDev.getInstance(ProjectService.class).findByPath(projectPath);
if (project == null) throw new IllegalArgumentException("Unknown project path: " + projectPath); Try / catch
try { import.getProject(); } catch (ExplicitException e) { reportBadImportPath(e.getMessage()); } Prevention
- Copy project paths from the project URL instead of typing them.
- Grep build specs for imports when renaming/deleting projects.
- Watch project audit log for renames that break downstream imports.
When it happens
Trigger: getProject() called (directly or via project(), isValid(), or getCommit()) when findByPath(projectPath) returns null — the path in the `project` field of the import does not match any existing project.
Common situations: Typo in project path (case sensitivity, missing parent path); imported project was renamed, archived, or deleted; project exists on a different OneDev instance/tenant than assumed.
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
- Project not found:
- 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/cd731c94d00fd319.
Report an issue: GitHub.