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 docker

What it means

ServerDockerProvisioner.submitTask throws ExplicitException when the task is pinned to a specific agent (pinnedAgentId != null). A workspace previously provisioned on a (remote) agent cannot have its cluster tasks executed via the server-docker provisioner — the pin is incompatible.

Source

Thrown at server-plugin/server-plugin-provisioner-serverdocker/src/main/java/io/onedev/server/plugin/provisioner/serverdocker/ServerDockerProvisioner.java:557

			throw new RuntimeException(e);
		}
		return serverHost;
	}

	protected int getConcurrencyNumber() {
		return concurrency != null ? concurrency : 0;
	}

	@Override
	public List<RegistryLoginFacade> getRegistryLogins(String token) {
		return getRegistryLoginFacades(token);
	}

	@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 docker""");
		}
		logger.log("Pending resource allocation...");
		return getResourceService().submitServerTask(
				pinnedServerAddress, getName(), getConcurrencyNumber(), 1, task);
	}

	@Override
	public void deleteWorkspace(Long projectId, Long workspaceNumber, @Nullable String pinnedServer, @Nullable Long pinnedAgentId) {
		ServerProvisionerUtils.deleteWorkspace(projectId, workspaceNumber, pinnedServer);
	}

	@Override
	public boolean isApplicable(Project project) {
		return getApplicableProjects() == null || WildcardUtils.matchPath(getApplicableProjects(), project.getPath());
	}

View on GitHub (pinned to d44925c47c)

Solutions

  1. Re-create/reprovision the workspace so it is provisioned by server docker without agent pinning
  2. Clear the stale agent pin on the workspace (or reset workspace state) before re-running
  3. Keep the workspace on its original agent-based provisioner if it must run on that agent
  4. If migrating provisioners intentionally, create a fresh workspace instead of reprovisioning the old one

Example fix

null
Defensive patterns

Strategy: validation

Validate before calling

if (task.getPinnedAgentId() != null) { throw new IllegalStateException('Use the original agent-based provisioner for this workspace'); }

Try / catch

try { submitTask(...); } catch (ExplicitException e) { if (e.getMessage().contains('provisioned on agent')) recreateWorkspaceWithoutAgentPin(); else throw e; }

Prevention

When it happens

Trigger: A cluster task with a non-null pinnedAgentId submitted against the server docker provisioner — typically a workspace that was originally provisioned by the agent/server-shell provisioner and later switched to server docker, then re-provisioned or resumed with a stale agent pin.

Common situations: Migrating workspaces from agent-based provisioner to server docker; stale workspace state referencing an old agent after provisioner change; resuming an interrupted task pinned to a decommissioned agent.

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


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/141f379d37d9cf50. Report an issue: GitHub.