{"record":{"id":"c2919c2355e22e0f","repo":"paperclipai/paperclip","slug":"issue-not-found-c2919c","errorCode":"issue_not_found","errorMessage":"issue_not_found: Issue not found.","messagePattern":"issue_not_found: Issue not found\\.","errorType":"error_code","errorClass":"RunnerGoalActionError","httpStatus":null,"severity":"error","filePath":"server/src/services/runner-goals.ts","lineNumber":357,"sourceCode":"      adapterType: binding.agent.adapterType,\n      sessionId: session?.id ?? null,\n      capability: storedCapability(session, capabilityForAgent(binding.agent)),\n      goal,\n      workingNow: goal?.workingNow ?? false,\n      activeRunId: activeRun?.id ?? null,\n      pendingAction: projectedPendingAction,\n      revision: session?.goalRevision ?? 0,\n      observedAt: session?.goalObservedAt?.toISOString() ?? null,\n    };\n  }\n\n  async function act(\n    companyId: string,\n    issueId: string,\n    request: RunnerGoalActionRequest,\n  ): Promise<RunnerGoalActionAccepted> {\n    const binding = await readBinding(companyId, issueId, request.agentId);\n    if (!binding) throw new RunnerGoalActionError(\"issue_not_found\", \"Issue not found.\");\n    if (!binding.agent) throw new RunnerGoalActionError(\"agent_not_found\", \"Agent not found.\");\n    if (binding.issue.assigneeAgentId !== request.agentId) {\n      throw new RunnerGoalActionError(\"agent_not_assigned\", \"The selected agent is not assigned to this issue.\");\n    }\n    const fallbackCapability = capabilityForAgent(binding.agent);\n    const initialProjection = await projection(companyId, issueId, request.agentId);\n    if (!initialProjection) throw new RunnerGoalActionError(\"issue_not_found\", \"Issue not found.\");\n    if (initialProjection.capability.availability !== \"available\") {\n      throw new RunnerGoalActionError(\n        initialProjection.capability.reasonCode ?? \"session_goals_unsupported\",\n        initialProjection.capability.reason ?? \"Session goals are unsupported.\",\n      );\n    }\n\n    const accepted = await db.transaction(async (tx) => {\n      await tx.insert(agentTaskSessions).values({\n        companyId,\n        agentId: request.agentId,","sourceCodeStart":339,"sourceCodeEnd":375,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/server/src/services/runner-goals.ts#L339-L375","documentation":"runner-goals `act` validates that the (companyId, issueId, agentId) triple resolves to an existing binding before executing a runner goal action. When readBinding finds no issue for that company/id it throws RunnerGoalActionError with code 'issue_not_found' — the API surface for 'this issue does not exist (or is not visible in this company)'.","triggerScenarios":"Calling the runner-goal action endpoint with an issueId that does not exist, was deleted, belongs to a different companyId than the one in the request path/auth scope, or a malformed id string.","commonSituations":"Client caching a stale issue id after the issue was deleted or merged; cross-company access where the agent passes an issue id from another company; copy-paste of an id from a different environment (dev vs prod); typo in the id.","solutions":["Verify the issueId exists via the issues list/get endpoint in the same company before acting","Confirm the companyId in the request matches the company the issue belongs to","Refresh the client's issue id from the server (stale cache) and retry","Check for environment mix-ups (dev ids used against prod API)"],"exampleFix":"// before: acting on a possibly stale id\nawait act(companyId, issueId, request);\n// after: resolve first\nconst issue = await getIssue(companyId, issueId);\nif (!issue) throw new Error(`Issue ${issueId} not found in company ${companyId}`);\nawait act(companyId, issueId, request);","handlingStrategy":"try-catch","validationCode":"const exists = await issueExists(companyId, issueId);\nif (!exists) throw new Error(`Issue ${issueId} not found in company ${companyId}`);","typeGuard":null,"tryCatchPattern":"try {\n  await act(companyId, issueId, request);\n} catch (e) {\n  if (e instanceof RunnerGoalActionError && e.code === 'issue_not_found') {\n    // refresh issue id / check companyId scope before retrying\n  } else throw e;\n}","preventionTips":["Always pair the action with the companyId that owns the issue","Re-fetch issue ids instead of relying on long-lived client caches","Guard against cross-environment id reuse (dev vs prod)","Return 404-style semantics early in clients when the issue list does not contain the id"],"tags":["runner-goals","issue","not-found"],"backgroundTag":"resource-not-found","analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-09-10T03:14:50.855Z","contentChangedAt":"2026-09-10T03:14:50.855Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}