{"record":{"id":"de77818d30a635ca","repo":"theonedev/onedev","slug":"unable-to-find-agent-0","errorCode":null,"errorMessage":"Unable to find agent {0}","messagePattern":"Unable to find agent (.+?)","errorType":"exception","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/web/page/admin/buildsetting/agent/AgentDetailPage.java","lineNumber":41,"sourceCode":"import io.onedev.server.web.component.tabbable.Tab;\nimport io.onedev.server.web.component.tabbable.Tabbable;\nimport io.onedev.server.web.page.admin.AdministrationPage;\n\npublic abstract class AgentDetailPage extends AdministrationPage {\n\n\tpublic static final String PARAM_AGENT = \"agent\";\n\t\n\tprotected final IModel<Agent> agentModel;\n\t\n\tpublic AgentDetailPage(PageParameters params) {\n\t\tsuper(params);\n\n\t\tString agentName = params.get(PARAM_AGENT).toString();\n\t\t\n\t\tAgent agent = OneDev.getInstance(AgentService.class).findByName(agentName);\n\t\t\n\t\tif (agent == null) \n\t\t\tthrow new ExplicitException(MessageFormat.format(_T(\"Unable to find agent {0}\"), agentName));\n\t\t\n\t\tLong agentId = agent.getId();\n\t\t\n\t\tagentModel = new LoadableDetachableModel<Agent>() {\n\n\t\t\t@Override\n\t\t\tprotected Agent load() {\n\t\t\t\treturn OneDev.getInstance(AgentService.class).load(agentId);\n\t\t\t}\n\t\t\t\n\t\t};\n\t\t\n\t\t// we do not need to reload the project this time as we already have that object on hand\n\t\tagentModel.setObject(agent);\n\t}\n\t\n\t@Override\n\tprotected void onInitialize() {","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/web/page/admin/buildsetting/agent/AgentDetailPage.java#L23-L59","documentation":"AgentDetailPage constructor resolves the 'agent' page parameter to an Agent by name and throws this ExplicitException (MessageFormat with the name) when no such agent exists, so the admin page fails fast instead of rendering with a null model.","triggerScenarios":"Opening /~admin/agents/<name> (or a link/bookmark) where <name> does not match any registered build agent.","commonSituations":"Agent was deleted or renamed after a bookmark/link was saved; typo in agent name; agent registered on a different OneDev instance (restored DB or changed server).","solutions":["Check the agent name in Admin > Agents and use the exact name in the URL.","Update or remove stale bookmarks/links pointing at the removed agent.","Re-register the agent if it was deleted by mistake."],"exampleFix":"// before: /~admin/agents/build-agent-1 (agent renamed)\n// after: /~admin/agents/runner-1 (current agent name)","handlingStrategy":"fallback","validationCode":"var agent = OneDev.getInstance(AgentService.class).findByName(name);\nif (agent == null) { /* redirect to agent list instead of deep link */ }","typeGuard":null,"tryCatchPattern":"try {\n    return AgentDetailPage.forAgent(name);\n} catch (ExplicitException e) {\n    return redirectToAgentList();\n}","preventionTips":["List agents from the Admin page rather than bookmarks.","Refresh links after renaming/removing agents.","Validate agent names against AgentService before building links."],"tags":["onedev","agent","not-found"],"backgroundTag":"entity-not-found","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}