{"record":{"id":"ccc48f477646a0ff","repo":"microsoft/vscode","slug":"failed-to-commit-changes-please-commit-or-stash-y","errorCode":null,"errorMessage":"Failed to commit changes. Please commit or stash your changes manually before using the cloud agent.","messagePattern":"Failed to commit changes\\. Please commit or stash your changes manually before using the cloud agent\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"extensions/copilot/src/extension/chatSessions/vscode-node/copilotCloudGitOperationsManager.ts","lineNumber":127,"sourceCode":"\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\n\tprivate async handleInteractiveCommit(repository: Repository): Promise<boolean> {\n\t\tconst COMMIT_YOUR_CHANGES = vscode.l10n.t('Commit your changes to continue cloud agent session. Close integrated terminal to cancel.');\n\t\treturn vscode.window.withProgress({\n\t\t\ttitle: COMMIT_YOUR_CHANGES,\n\t\t\tcancellable: true,\n\t\t\tlocation: vscode.ProgressLocation.Notification\n\t\t}, async (_, token) => {\n\t\t\treturn new Promise<boolean>((resolve) => {\n\t\t\t\tconst startingCommit = repository.state.HEAD?.commit;\n\t\t\t\tconst terminal = vscode.window.createTerminal({\n\t\t\t\t\tname: 'GitHub Copilot Cloud Agent',\n\t\t\t\t\tcwd: repository.rootUri.fsPath,\n\t\t\t\t\tmessage: `\\x1b[1m${COMMIT_YOUR_CHANGES}\\x1b[0m`\n\t\t\t\t});","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/microsoft/vscode/blob/a94b963a32aa9749d69504576791fa29700ae46d/extensions/copilot/src/extension/chatSessions/vscode-node/copilotCloudGitOperationsManager.ts#L109-L145","documentation":"Error \"Failed to commit changes. Please commit or stash your changes manually before using the cloud agent.\" thrown in microsoft/vscode.","triggerScenarios":"Thrown at extensions/copilot/src/extension/chatSessions/vscode-node/copilotCloudGitOperationsManager.ts:127 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"}