{"record":{"id":"a5cff311b620dc3c","repo":"microsoft/vscode","slug":"failed-to-automatically-commit-and-push-your-chang","errorCode":null,"errorMessage":"Failed to automatically commit and push your changes. Please commit or stash your changes manually and try again.","messagePattern":"Failed to automatically commit and push your changes\\. Please commit or stash your changes manually and try again\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"extensions/copilot/src/extension/chatSessions/vscode-node/copilotCloudGitOperationsManager.ts","lineNumber":113,"sourceCode":"\t\t});\n\t\treturn hasRemoteBranch;\n\t}\n\n\tasync commitAndPushChanges(): Promise<string> {\n\t\tconst { repository, remoteName, baseRef } = await this.repoInfo();\n\t\tconst asyncBranch = await this.generateRandomBranchName(repository, 'copilot');\n\n\t\tconst commitMessage = vscode.l10n.t('Checkpoint from VS Code for cloud agent session');\n\t\ttry {\n\t\t\tawait repository.createBranch(asyncBranch, true);\n\t\t\tawait this.performCommit(asyncBranch, repository, commitMessage);\n\t\t\tawait repository.push(remoteName, asyncBranch, true);\n\t\t\tawait this.switchBackToBaseRef(repository, baseRef, asyncBranch);\n\t\t\treturn asyncBranch;\n\t\t} catch (error) {\n\t\t\tawait this.rollbackToOriginalBranch(repository, baseRef);\n\t\t\tthis.logService.error(`Failed to automatically commit and push your changes: ${error instanceof Error ? error.message : String(error)}`);\n\t\t\tthrow new Error(vscode.l10n.t('Failed to automatically commit and push your changes. Please commit or stash your changes manually and try again.'));\n\t\t}\n\t}\n\n\tprivate async performCommit(asyncBranch: string, repository: Repository, commitMessage: string): Promise<void> {\n\t\ttry {\n\t\t\tawait repository.commit(commitMessage, { all: true });\n\t\t\tif (repository.state.HEAD?.name !== asyncBranch || repository.state.workingTreeChanges.length > 0 || repository.state.indexChanges.length > 0) {\n\t\t\t\tthrow new Error(vscode.l10n.t('Uncommitted changes still detected.'));\n\t\t\t}\n\t\t} catch (error) {\n\t\t\t// TODO: stream.progress('waiting for user to manually commit changes');\n\t\t\tconst commitSuccessful = await this.handleInteractiveCommit(repository);\n\t\t\tif (!commitSuccessful) {\n\t\t\t\tthrow new Error(vscode.l10n.t('Failed to commit changes. Please commit or stash your changes manually before using the cloud agent.'));\n\t\t\t}\n\t\t}\n\t}\n","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/microsoft/vscode/blob/a94b963a32aa9749d69504576791fa29700ae46d/extensions/copilot/src/extension/chatSessions/vscode-node/copilotCloudGitOperationsManager.ts#L95-L131","documentation":"Error \"Failed to automatically commit and push your changes. Please commit or stash your changes manually and try again.\" thrown in microsoft/vscode.","triggerScenarios":"Thrown at extensions/copilot/src/extension/chatSessions/vscode-node/copilotCloudGitOperationsManager.ts:113 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"}