theonedev/onedev · error · ExplicitException
This workspace is provisioned on agent previously, and canno
Error message
This workspace is provisioned on agent previously, and cannot be reprovisioned via server shell
What it means
ServerShellProvisioner.submitTask() throws when the cluster task is pinned to an agent (pinnedAgentId != null). Workspaces previously provisioned on an agent cannot be re-provisioned through the server shell path; the provisioner only supports server-pinned or unpinned tasks. This is an intentional state restriction (invalid state transition) between agent-based and server-shell provisioning.
Source
Thrown at server-plugin/server-plugin-provisioner-servershell/src/main/java/io/onedev/server/plugin/provisioner/servershell/ServerShellProvisioner.java:249
}
@Override
public String getPortHost() {
throw new UnsupportedOperationException();
}
};
}
protected int getConcurrencyNumber() {
return concurrency != null ? concurrency : 0;
}
@Override
public <T> Future<T> submitTask(@Nullable String pinnedServerAddress, @Nullable Long pinnedAgentId,
ClusterTask<T> task, TaskLogger logger) {
if (pinnedAgentId != null) {
throw new ExplicitException("""
This workspace is provisioned on agent previously, \
and cannot be reprovisioned via server shell""");
}
logger.log("Pending resource allocation...");
return getResourceService().submitServerTask(
pinnedServerAddress, getName(), getConcurrencyNumber(), 1, task);
}
@Override
public void deleteWorkspace(Long projectId, Long workspaceNumber, String pinnedServer, Long pinnedAgentId) {
ServerProvisionerUtils.deleteWorkspace(projectId, workspaceNumber, pinnedServer);
}
@Override
public boolean isApplicable(Project project) {
return WildcardUtils.matchPath(getApplicableProjects(), project.getPath());
}
View on GitHub (pinned to d44925c47c)
Solutions
- Clear/reset the workspace so it is provisioned fresh via server shell (remove the old workspace and its recorded agent pin)
- Reassign the job back to an agent-based (e.g. docker) provisioner matching the original provisioning
- Recreate the agent/pool configuration so the pin no longer points to a removed agent
Example fix
// before: reusing stale agent-pinned workspace on server shell // after: reset workspace project.build.resetWorkspace(); // or delete workspace then re-run job
Defensive patterns
Strategy: validation
Validate before calling
if (workspace.getProvisionedAgentId() != null) throw new IllegalStateException("Reset workspace before server-shell reprovisioning"); Try / catch
try { provisioner.submitTask(addr, agentId, task, logger); } catch (ExplicitException e) { /* reset workspace or reassign to agent provisioner */ } Prevention
- Reset or delete workspaces when changing an agent's provisioner from agent-based to server shell
- Avoid reusing agent-pinned workspaces across provisioner types
- Document that server shell cannot reprovision agent-provisioned workspaces
When it happens
Trigger: submitTask() invoked with a non-null pinnedAgentId — typically when a workspace recorded as agent-provisioned is being reprovisioned after the agent/provisioner was switched to server shell.
Common situations: Re-running a job whose workspace was originally provisioned by a docker/agent provisioner but is now assigned to a Server Shell agent; agent pool reconfiguration without clearing the workspace's recorded provisioning.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- Allocated agent not connected to current server, please retr
- This workspace can only be provisioned by docker provisioner
- Shell provisioner does not allow absolute cache path:
- Pull request is closed
- Attachment not found:
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/0210d94796f3f57f.
Report an issue: GitHub.