{"record":{"id":"95f9a0e7944ce62c","repo":"paperclipai/paperclip","slug":"issue-has-no-current-execution-workspace","errorCode":null,"errorMessage":"Issue has no current execution workspace","messagePattern":"Issue has no current execution workspace","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/mcp-server/src/tools.ts","lineNumber":374,"sourceCode":"        const qs = companyId ? `?companyId=${encodeURIComponent(companyId)}` : \"\";\n        return client.requestJson(\"GET\", `/projects/${encodeURIComponent(projectId)}${qs}`);\n      },\n    ),\n    makeTool(\n      \"paperclipGetIssueWorkspaceRuntime\",\n      \"Get the current execution workspace and runtime services for an issue, including service URLs\",\n      z.object({ issueId: issueIdSchema }),\n      async ({ issueId }) => getIssueWorkspaceRuntime(client, issueId),\n    ),\n    makeTool(\n      \"paperclipControlIssueWorkspaceServices\",\n      \"Start, stop, or restart the current issue execution workspace runtime services\",\n      issueWorkspaceRuntimeControlSchema,\n      async ({ issueId, action, ...target }) => {\n        const runtime = await getIssueWorkspaceRuntime(client, issueId);\n        const workspaceId = typeof runtime.workspace?.id === \"string\" ? runtime.workspace.id : null;\n        if (!workspaceId) {\n          throw new Error(\"Issue has no current execution workspace\");\n        }\n        return client.requestJson(\n          \"POST\",\n          `/execution-workspaces/${encodeURIComponent(workspaceId)}/runtime-services/${action}`,\n          { body: target },\n        );\n      },\n    ),\n    makeTool(\n      \"paperclipWaitForIssueWorkspaceService\",\n      \"Wait until an issue execution workspace runtime service is running and has a URL when one is exposed\",\n      waitForIssueWorkspaceServiceSchema,\n      async ({ issueId, runtimeServiceId, serviceName, timeoutSeconds }) => {\n        const deadline = Date.now() + (timeoutSeconds ?? 60) * 1000;\n        let latest: Awaited<ReturnType<typeof getIssueWorkspaceRuntime>> | null = null;\n        while (Date.now() <= deadline) {\n          latest = await getIssueWorkspaceRuntime(client, issueId);\n          const service = selectRuntimeService(latest.runtimeServices, { runtimeServiceId, serviceName });","sourceCodeStart":356,"sourceCodeEnd":392,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/packages/mcp-server/src/tools.ts#L356-L392","documentation":"The paperclipControlIssueWorkspaceServices tool first fetches the issue's workspace runtime via getIssueWorkspaceRuntime and then requires runtime.workspace?.id to be a string before issuing the control POST. If the issue has no current execution workspace (id missing or non-string), it throws before calling the API.","triggerScenarios":"Invoking start/stop/restart on runtime services for an issue that has not been assigned an execution workspace yet, or whose workspace was deleted/archived so the runtime response omits workspace.id.","commonSituations":"Issue was never started / no run launched; workspace provisioning still in progress; workspace torn down after run completion; calling control before create-issue-workspace.","solutions":["Call paperclipGetIssueWorkspaceRuntime and inspect the response — if workspace is null, create/start a workspace first.","Ensure the issue has an active run (agent dispatched) that provisions the workspace.","Wait for workspace provisioning to complete and retry."],"exampleFix":"// before\nawait controlIssueWorkspaceServices({ issueId, action: 'restart' })  // -> error\n// after\nconst rt = await getIssueWorkspaceRuntime(issueId)\nif (!rt.workspace?.id) await createIssueWorkspace(issueId)\nawait controlIssueWorkspaceServices({ issueId, action: 'restart' })","handlingStrategy":"try-catch","validationCode":"const rt = await getIssueWorkspaceRuntime(client, issueId);\nif (typeof rt.workspace?.id !== 'string') throw new Error(`Issue ${issueId} has no workspace; create one first`);","typeGuard":"function hasWorkspaceId(rt: unknown): rt is { workspace: { id: string } } {\n  return typeof rt === 'object' && rt !== null && typeof (rt as any).workspace?.id === 'string';\n}","tryCatchPattern":"try { await controlIssueWorkspaceServices({ issueId, action }) }\ncatch (e) {\n  if (/no current execution workspace/.test(String(e.message))) { await createIssueWorkspace(issueId); /* retry */ } else throw e;\n}","preventionTips":["Fetch the runtime and confirm workspace.id before issuing control calls.","Ensure an active run is provisioned before driving runtime services.","Treat a missing workspace as a state precondition, not a transient error."],"tags":["paperclip-mcp","workspace","runtime","state-dependent"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}