{"record":{"id":"edbf385a0e0c37c5","repo":"paperclipai/paperclip","slug":"wiki-maintainer-agent-is-not-invokable-while-statu","errorCode":null,"errorMessage":"Wiki Maintainer agent is not invokable while status is ${agent.status}.","messagePattern":"Wiki Maintainer agent is not invokable while status is (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/plugins/plugin-llm-wiki/src/wiki/core.ts","lineNumber":3879,"sourceCode":"    await ctx.issues.update(operation.issue.id, { status: \"blocked\" }, input.companyId);\n    await ctx.issues.createComment(operation.issue.id, warning, input.companyId);\n    throw new Error(warning);\n  }\n\n  const agent = await ctx.agents.get(agentId, input.companyId);\n  if (!agent || agent.status === \"paused\" || agent.status === \"terminated\" || agent.status === \"pending_approval\") {\n    const warning = agent\n      ? `Wiki Maintainer agent is not invokable while status is ${agent.status}.`\n      : \"Wiki Maintainer agent could not be loaded.\";\n    await markOperation(ctx, {\n      companyId: input.companyId,\n      operationId: operation.operationId,\n      status: \"blocked\",\n      warning,\n    });\n    await ctx.issues.update(operation.issue.id, { status: \"blocked\" }, input.companyId);\n    await ctx.issues.createComment(operation.issue.id, warning, input.companyId);\n    throw new Error(warning);\n  }\n\n  const session = await ctx.agents.sessions.create(agentId, input.companyId, {\n    taskKey: `plugin:${PLUGIN_ID}:session:wiki:${wikiId}:query:${operation.operationId}`,\n    reason: \"LLM Wiki query session\",\n  });\n  await ctx.db.execute(\n    `INSERT INTO ${tableName(ctx.db.namespace, \"wiki_query_sessions\")}\n       (id, company_id, wiki_id, space_id, hidden_issue_id, agent_session_id, status, filed_outputs)\n     VALUES ($1, $2, $3, $6, $4, $5, 'active', '[]'::jsonb)`,\n    [operation.operationId, input.companyId, wikiId, operation.issue.id, session.sessionId, space.id],\n  );\n\n  const prompt = buildQueryPrompt({ companyId: input.companyId, wikiId, space, question });\n  ctx.streams.open(channel, input.companyId);\n  ctx.streams.emit(channel, {\n    type: \"query.started\",\n    operationId: operation.operationId,","sourceCodeStart":3861,"sourceCodeEnd":3897,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/packages/plugins/plugin-llm-wiki/src/wiki/core.ts#L3861-L3897","documentation":"Thrown when a Wiki Maintainer agent IS configured but its status is one of 'paused', 'terminated', or 'pending_approval', meaning it cannot be invoked for a session. Like error 504 the operation is marked blocked, the issue set to blocked, and a comment posted with the specific status before throwing.","triggerScenarios":"The selected Wiki Maintainer agent has status 'paused' (e.g. budget hard-stop auto-pause), 'terminated', or 'pending_approval' at the moment a query operation tries to create a session for it.","commonSituations":"Agent was auto-paused by the budget hard-stop; agent is awaiting first-run approval; an operator terminated the agent but the Wiki selection still points to it.","solutions":["Resume/un-pause the agent (resolve the budget or approval gate) and retry the operation.","If the agent was terminated, select a new Wiki Maintainer agent via select-managed-agent.","Check the agent status via ctx.agents.get before invoking, and surface a friendlier message upstream."],"exampleFix":"// before: agent.status === 'paused' -> operation blocked\n// after: resume the agent (clear budget/approval gate) then re-trigger the query","handlingStrategy":"validation","validationCode":"async function assertAgentInvokable(ctx: PluginContext, agentId: string, companyId: string) {\n  const agent = await ctx.agents.get(agentId, companyId);\n  if (!agent || agent.status === 'paused' || agent.status === 'terminated' || agent.status === 'pending_approval') {\n    throw new Error(`Wiki Maintainer agent not invokable (status: ${agent?.status ?? 'missing'})`);\n  }\n}","typeGuard":"const INVOKABLE_AGENT_STATUSES = new Set(['active', 'idle', 'running']);\nfunction isAgentInvokable(agent: { status: string } | null): agent is { status: string } {\n  return !!agent && INVOKABLE_AGENT_STATUSES.has(agent.status);\n}","tryCatchPattern":"try {\n  await runWikiQuery(ctx, input);\n} catch (err) {\n  if (err instanceof Error && /not invokable while status is/.test(err.message)) {\n    // resume agent (clear budget/approval) then retry\n  } else throw err;\n}","preventionTips":["Check agent status before issuing a query.","Resolve budget hard-stop / approval gates that auto-pause agents."],"tags":["paperclip","wiki","agent","lifecycle"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}