theonedev/onedev · error · ExplicitException
Active server not found for project id: %s
Error message
Active server not found for project id: %s
What it means
OneDev throws this ExplicitException from ProjectService.getActiveServer when no active server is registered for the given project id and mustExist is true. Active servers track which cluster node is currently handling a project's operations (e.g. for job executors in a cluster); querying one for a project that no node is serving is treated as an error.
Source
Thrown at server-core/src/main/java/io/onedev/server/service/impl/DefaultProjectService.java:1169
@Override
public String getFavoriteQuery(User user) {
if (user != null && !user.getProjectQueryPersonalization().getQueries().isEmpty()) {
return user.getProjectQueryPersonalization().getQueries().iterator().next().getQuery();
} else {
GlobalProjectSetting projectSetting = settingService.getProjectSetting();
if (!projectSetting.getNamedQueries().isEmpty())
return projectSetting.getNamedQueries().iterator().next().getQuery();
}
return null;
}
@Override
public String getActiveServer(Long projectId, boolean mustExist) {
var activeServer = activeServers.get(projectId);
if (activeServer != null)
return activeServer;
else if (mustExist)
throw new ExplicitException("Active server not found for project id: " + projectId);
else
return null;
}
@Override
public Set<Long> getActiveIds() {
var localServer = clusterService.getLocalServerAddress();
return new HashSet<>(activeServers.project(Map.Entry::getKey, entry -> entry.getValue().equals(localServer)));
}
@Override
public Map<String, Collection<Long>> groupByActiveServers(Collection<Long> projectIds) {
Map<String, Collection<Long>> projectIdsByServer = new HashMap<>();
for (var projectId: projectIds) {
var activeServer = activeServers.get(projectId);
if (activeServer != null) {
var projectIdsOnServer = projectIdsByServer.computeIfAbsent(activeServer, k -> new HashSet<>());
projectIdsOnServer.add(projectId);View on GitHub (pinned to d44925c47c)
Solutions
- Verify the project id is correct and the project exists.
- Ensure the project is activated/running on a cluster node (e.g. trigger its job or open it so a server claims it).
- Call getActiveServer(projectId, false) if a null result is acceptable, and handle the missing-server case in caller code.
- In a cluster, check node health and restart failed nodes so projects get reactivated.
Example fix
// before
String server = projectService.getActiveServer(projectId, true); // throws if absent
// after
String server = projectService.getActiveServer(projectId, false);
if (server == null) {
// handle: project not active on any node
return;
} Defensive patterns
Strategy: fallback
Validate before calling
// Only ask for a mandatory server if the project is known active
Set<Long> activeIds = projectService.getActiveIds();
if (!activeIds.contains(projectId)) {
// project not active on any node; skip or activate first
return;
}
String server = projectService.getActiveServer(projectId, true); Type guard
function hasActiveServer(projectService, projectId) {
return projectService.getActiveIds().has(projectId);
} Try / catch
try {
String server = projectService.getActiveServer(projectId, true);
} catch (ExplicitException e) {
logger.warn("No active server for project {}: {}", projectId, e.getMessage());
// fall back to local handling or re-activate the project
} Prevention
- Call getActiveServer(projectId, false) when absence is a normal case
- In clusters, monitor node health so projects are reactivated after failures
- Validate project ids before querying active servers
- Treat 'no active server' as an expected state in polling/automation loops
When it happens
Trigger: Calling ProjectService.getActiveServer(projectId, true) when the project has never been activated on any server, or its server was stopped/decommissioned, or the project id is wrong.
Common situations: Cluster environments where a node handling the project went down; calls made from a different node before project activation has propagated; stale references to deleted/moved projects; scripts polling active servers for a project that is not currently running anything.
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
- Upload project not found:
- Unable to discover cluster ip from database connection url:
- Access denied
- Pull request is closed
- Unable to find project to import build spec: {0}
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/7f6bfb9651976c95.
Report an issue: GitHub.