{"record":{"id":"e1ea9dc2e34584a6","repo":"microsoft/vscode","slug":"unable-to-load-the-task-to-create-a-pull-request","errorCode":null,"errorMessage":"Unable to load the task to create a pull request.","messagePattern":"Unable to load the task to create a pull request\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"extensions/copilot/src/extension/chatSessions/vscode-node/copilotCloudSessionsProvider.ts","lineNumber":1696,"sourceCode":"\t\t// Re-entrancy guard: ignore repeat invocations while a create-PR request for this task is\n\t\t// still in flight (e.g. the toolbar action triggered again before the first call settled)\n\t\t// so we don't submit duplicate PRs. Hide the toolbar action immediately; it is restored on\n\t\t// failure below, and on success it is replaced by the \"Open pull request\" action.\n\t\tif (this._createPullRequestInFlightTaskIds.has(taskId)) {\n\t\t\treturn;\n\t\t}\n\t\tthis._createPullRequestInFlightTaskIds.add(taskId);\n\t\tthis.setCanCreatePullRequestContext(false);\n\n\t\ttry {\n\t\t\tawait vscode.window.withProgress(\n\t\t\t\t{ location: vscode.ProgressLocation.Notification, title: vscode.l10n.t('Creating pull request') },\n\t\t\t\tasync () => {\n\t\t\t\t\t// The backend creates the PR for the full task, resolving `{owner, repo}` itself\n\t\t\t\t\t// (from the task's `html_url`, falling back to a GitHub lookup by `repository.id`).\n\t\t\t\t\tconst taskContent = await backend.fetchTaskContent(taskId);\n\t\t\t\t\tif (!taskContent) {\n\t\t\t\t\t\tthrow new Error(vscode.l10n.t('Unable to load the task to create a pull request.'));\n\t\t\t\t\t}\n\t\t\t\t\tconst result = await backend.createPullRequestForTask(taskContent.task);\n\t\t\t\t\t/* __GDPR__\n\t\t\t\t\t\t\"copilotcloud.chat.createPRFromTask\" : {\n\t\t\t\t\t\t\t\"owner\": \"osortega\",\n\t\t\t\t\t\t\t\"comment\": \"Event sent when the user invokes the 'Create pull request' toolbar action on a settled cloud task without a pull request.\",\n\t\t\t\t\t\t\t\"outcome\": { \"classification\": \"SystemMetaData\", \"purpose\": \"FeatureInsight\", \"comment\": \"Whether the create-pull-request call succeeded or failed.\" }\n\t\t\t\t\t\t}\n\t\t\t\t\t*/\n\t\t\t\t\tthis.telemetry.sendMSFTTelemetryEvent('copilotcloud.chat.createPRFromTask', {\n\t\t\t\t\t\toutcome: !!result ? 'success' : 'failure'\n\t\t\t\t\t});\n\t\t\t\t\t// Wait until the new PR is reflected on the task as a `pull` artifact so the gate\n\t\t\t\t\t// update below sees `hasPullRequest` and flips to the \"Open pull request\" action.\n\t\t\t\t\tawait this._waitForTaskPullRequestReflected(backend, taskId);\n\t\t\t\t},\n\t\t\t);\n\t\t} catch (error) {","sourceCodeStart":1678,"sourceCodeEnd":1714,"githubUrl":"https://github.com/microsoft/vscode/blob/a94b963a32aa9749d69504576791fa29700ae46d/extensions/copilot/src/extension/chatSessions/vscode-node/copilotCloudSessionsProvider.ts#L1678-L1714","documentation":"Error \"Unable to load the task to create a pull request.\" thrown in microsoft/vscode.","triggerScenarios":"Thrown at extensions/copilot/src/extension/chatSessions/vscode-node/copilotCloudSessionsProvider.ts:1696 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"a94b963a32aa9749d69504576791fa29700ae46d","analyzedAt":"2026-08-12T01:08:56.794Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}