paperclipai/paperclip · error · Error
Wiki Maintainer agent could not be loaded.
Error message
Wiki Maintainer agent could not be loaded.
What it means
Thrown when agentId is truthy but ctx.agents.get(agentId, companyId) returns null/undefined, i.e. the configured selection points to an agent that no longer exists in the company. The operation is marked blocked, the issue set to blocked, and a comment posted before throwing.
Source
Thrown at packages/plugins/plugin-llm-wiki/src/wiki/core.ts:3879
await ctx.issues.update(operation.issue.id, { status: "blocked" }, input.companyId);
await ctx.issues.createComment(operation.issue.id, warning, input.companyId);
throw new Error(warning);
}
const agent = await ctx.agents.get(agentId, input.companyId);
if (!agent || agent.status === "paused" || agent.status === "terminated" || agent.status === "pending_approval") {
const warning = agent
? `Wiki Maintainer agent is not invokable while status is ${agent.status}.`
: "Wiki Maintainer agent could not be loaded.";
await markOperation(ctx, {
companyId: input.companyId,
operationId: operation.operationId,
status: "blocked",
warning,
});
await ctx.issues.update(operation.issue.id, { status: "blocked" }, input.companyId);
await ctx.issues.createComment(operation.issue.id, warning, input.companyId);
throw new Error(warning);
}
const session = await ctx.agents.sessions.create(agentId, input.companyId, {
taskKey: `plugin:${PLUGIN_ID}:session:wiki:${wikiId}:query:${operation.operationId}`,
reason: "LLM Wiki query session",
});
await ctx.db.execute(
`INSERT INTO ${tableName(ctx.db.namespace, "wiki_query_sessions")}
(id, company_id, wiki_id, space_id, hidden_issue_id, agent_session_id, status, filed_outputs)
VALUES ($1, $2, $3, $6, $4, $5, 'active', '[]'::jsonb)`,
[operation.operationId, input.companyId, wikiId, operation.issue.id, session.sessionId, space.id],
);
const prompt = buildQueryPrompt({ companyId: input.companyId, wikiId, space, question });
ctx.streams.open(channel, input.companyId);
ctx.streams.emit(channel, {
type: "query.started",
operationId: operation.operationId,View on GitHub (pinned to 67001ec6eb)
Solutions
- Re-select a valid agent via select-managed-agent with an agentId that exists for this company.
- Run reset-managed-skills / reconcile-managed-skills to clear stale managed resource selections.
- Verify the agentId with ctx.agents.get at the caller and clear the selection automatically when it returns null.
Example fix
// before: stored agentId no longer resolves -> 'could not be loaded'
// after: re-select an existing agent
worker.actions['select-managed-agent']({ companyId, agentId: existingAgent.id }); Defensive patterns
Strategy: validation
Validate before calling
async function resolveWikiAgent(ctx: PluginContext, companyId: string) {
const agentId = await getWikiAgentSelection(ctx, companyId);
if (!agentId) throw new Error('No Wiki Maintainer selected');
const agent = await ctx.agents.get(agentId, companyId);
if (!agent) {
await worker.actions['reset-managed-skills']({ companyId });
throw new Error('Stale agent selection; reset and re-select');
}
return agent;
} Try / catch
try {
await runWikiQuery(ctx, input);
} catch (err) {
if (err instanceof Error && /could not be loaded/.test(err.message)) {
await worker.actions['select-managed-agent']({ companyId, agentId: existingAgent.id });
} else throw err;
} Prevention
- When an agent is deleted, clear its managed-resource selection immediately.
- Run reconcile-managed-skills after agent lifecycle changes.
When it happens
Trigger: The stored Wiki Maintainer agent selection references an agentId that ctx.agents.get cannot load (deleted, wrong company, data corruption, stale selection after agent re-creation).
Common situations: Agent was deleted but the managed-resource selection was never reset; agentId was copied across environments; company-scoping mismatch where the agent belongs to a different company.
Related errors
- No configured Wiki Maintainer agent is available for this co
- Wiki Maintainer agent is not invokable while status is ${age
- agentId is required
- selected_projects exceeds the hard cap of ${MAX_PAPERCLIP_PR
- Project belongs to another company or does not exist: ${proj
AI-assisted analysis of paperclipai/paperclip@67001ec6eb (2026-08-12).
Data as JSON: /api/errors/51a5b9281ea2b8e4.
Report an issue: GitHub.