theonedev/onedev · error · ExplicitException
"No agent with name '" + value + "'"
Error message
"No agent with name '" + value + "'"
What it means
RanOnCriteria is a workspace search criterion matching workspaces that ran on a build agent. The constructor eagerly validates the agent name via AgentService.findByName and throws ExplicitException immediately if no agent with that name exists.
Source
Thrown at server-core/src/main/java/io/onedev/server/search/entity/workspace/RanOnCriteria.java:27
import javax.persistence.criteria.Predicate;
import io.onedev.commons.utils.ExplicitException;
import io.onedev.server.OneDev;
import io.onedev.server.service.AgentService;
import io.onedev.server.model.Agent;
import io.onedev.server.model.Workspace;
import io.onedev.server.util.ProjectScope;
import io.onedev.server.util.criteria.Criteria;
public class RanOnCriteria extends Criteria<Workspace> {
private static final long serialVersionUID = 1L;
private final String value;
public RanOnCriteria(String value) {
if (OneDev.getInstance(AgentService.class).findByName(value) == null)
throw new ExplicitException("No agent with name '" + value + "'");
this.value = value;
}
public String getValue() {
return value;
}
@Override
public Predicate getPredicate(@Nullable ProjectScope projectScope, CriteriaQuery<?> query, From<Workspace, Workspace> from, CriteriaBuilder builder) {
Join<?, ?> join = from.join(Workspace.PROP_AGENT, JoinType.INNER);
join.on(builder.equal(join.get(Agent.PROP_NAME), value));
return join.isNotNull();
}
@Override
public boolean matches(Workspace workspace) {
return workspace.getAgent() != null && workspace.getAgent().getName().equals(value);
}View on GitHub (pinned to d44925c47c)
Solutions
- Check the exact agent name under OneDev admin Agents list and use it verbatim in the query.
- Register or re-register the agent with the name used in the query.
- Rename the agent back if it was renamed after queries were saved.
- Edit saved queries that reference the old agent name.
Example fix
// before
new RanOnCriteria("build-02") // agent renamed to builder-02
// after
new RanOnCriteria("builder-02") Defensive patterns
Strategy: validation
Validate before calling
var agent = OneDev.getInstance(AgentService.class).findByName(agentName);
if (agent == null) throw new IllegalArgumentException("Unknown agent: " + agentName); Try / catch
try {
var criteria = new RanOnCriteria(agentName);
} catch (ExplicitException e) {
// fall back / report unknown agent name
} Prevention
- Keep agent names in a shared constant/config referenced by queries
- Validate agent names against AgentService before building criteria
- Audit saved queries when renaming or removing agents
When it happens
Trigger: Parsing a workspace query containing a 'ran on' criterion whose quoted value is not the name of any registered agent, e.g. `ran on "nonexistent-agent"`.
Common situations: Typo in agent name in a saved search query; agent was renamed, removed or never registered; query copy-pasted between OneDev instances with different agent setups.
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
- Allocated agent not connected to current server, please retr
- Not authorized
- Unable to update attributes as agent is offline
- Criteria '' is not supported here
- Unexpected operator:
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/aa37d0ea5b133612.
Report an issue: GitHub.