paperclipai/paperclip · error · Error
Selected Wiki Maintainer agent was not found or is terminate
Error message
Selected Wiki Maintainer agent was not found or is terminated.
What it means
Thrown by selectWikiAgentResource when ctx.agents.get(agentId, companyId) returns nullish or returns an agent whose status is 'terminated'. The Wiki Maintainer binding must point at a live agent in the same company.
Source
Thrown at packages/plugins/plugin-llm-wiki/src/wiki/core.ts:2063
export async function resetWikiAgentResource(ctx: PluginContext, companyId: string): Promise<WikiAgentResource> {
const resolved = await ctx.agents.managed.reset(WIKI_MAINTAINER_AGENT_KEY, companyId);
if (resolved.agentId) {
await upsertResourceBinding(ctx, {
companyId,
wikiId: DEFAULT_WIKI_ID,
resourceKind: "agent",
resourceKey: WIKI_MAINTAINER_AGENT_KEY,
resolvedId: resolved.agentId,
metadata: { source: "managed-default", updatedBy: "reset" },
});
}
return agentResource({ status: resolved.status, source: "managed", agent: resolved.agent, defaultDrift: resolved.defaultDrift ?? null });
}
export async function selectWikiAgentResource(ctx: PluginContext, input: { companyId: string; agentId: string }): Promise<WikiAgentResource> {
const agent = await ctx.agents.get(input.agentId, input.companyId);
if (!agent || agent.status === "terminated") {
throw new Error("Selected Wiki Maintainer agent was not found or is terminated.");
}
await upsertResourceBinding(ctx, {
companyId: input.companyId,
wikiId: DEFAULT_WIKI_ID,
resourceKind: "agent",
resourceKey: WIKI_MAINTAINER_AGENT_KEY,
resolvedId: agent.id,
metadata: { source: "selected-existing", updatedBy: "settings" },
});
return agentResource({ status: "resolved", source: "selected", agent });
}
export async function reconcileWikiProjectResource(ctx: PluginContext, companyId: string): Promise<WikiProjectResource> {
const resolved = await ctx.projects.managed.reconcile(WIKI_PROJECT_KEY, companyId);
if (resolved.projectId) {
await upsertResourceBinding(ctx, {
companyId,
wikiId: DEFAULT_WIKI_ID,View on GitHub (pinned to 67001ec6eb)
Solutions
- Refresh the agent options via listWikiAgentOptions and only pick a non-terminated agent.
- If the desired agent is terminated, restart/recreate it before selecting.
- Fall back to resetWikiAgentResource to bind the managed default agent.
- Verify the companyId owns the agentId before submitting.
Example fix
// before
await selectWikiAgentResource(ctx, { companyId, agentId: pickedAgentId });
// after
const opts = await listWikiAgentOptions(ctx, companyId);
const live = opts.find((o) => o.id === pickedAgentId && o.status !== "terminated");
if (!live) {
return selectWikiAgentResource(await resetWikiAgentResource(ctx, companyId));
}
await selectWikiAgentResource(ctx, { companyId, agentId: live.id }); Defensive patterns
Strategy: validation
Validate before calling
async function ensureSelectableAgent(ctx, companyId, agentId) {
const opts = await listWikiAgentOptions(ctx, companyId);
const live = opts.find((o) => o.id === agentId && o.status !== "terminated");
if (!live) throw new Error("Selected Wiki Maintainer agent was not found or is terminated.");
return live.id;
} Type guard
function isLiveAgent(agent) {
return !!agent && agent.status !== "terminated";
} Try / catch
try {
await selectWikiAgentResource(ctx, { companyId, agentId });
} catch (err) {
if (/was not found or is terminated/.test(err.message)) {
return resetWikiAgentResource(ctx, companyId);
}
throw err;
} Prevention
- Populate the picker from listWikiAgentOptions and hide terminated agents.
- Restart terminated agents before binding.
- Fall back to the managed default via resetWikiAgentResource.
When it happens
Trigger: Calling selectWikiAgentResource with an agentId that does not exist, is terminated, or belongs to a different company.
Common situations: Selecting a previously terminated agent from a stale dropdown; cross-company agent id; agent deleted between UI load and selection; test fixture referencing a removed agent.
Related errors
- Project belongs to another company or does not exist: ${proj
- Issue belongs to another company or does not exist: ${issueI
- Selected LLM Wiki project was not found.
- selected_projects exceeds the hard cap of ${MAX_PAPERCLIP_PR
- root_issues exceeds the hard cap of ${MAX_PAPERCLIP_PROFILE_
AI-assisted analysis of paperclipai/paperclip@67001ec6eb (2026-08-12).
Data as JSON: /api/errors/5e616571eb054a39.
Report an issue: GitHub.