microsoft/vscode · error · Error

Failed to get main branch SHA

Error message

Failed to get main branch SHA

What it means

Error "Failed to get main branch SHA" thrown in microsoft/vscode.

Source

Thrown at extensions/copilot/src/extension/inlineEdits/vscode-node/components/nesFeedbackSubmitter.ts:507

	 * Upload feedback files to the private GitHub repository via a pull request.
	 * Creates a new branch, uploads files to a timestamped folder, and opens a PR.
	 * @returns The URL to the pull request, or undefined on failure.
	 */
	private async _uploadToPrivateRepo(files: FeedbackFile[], token: string): Promise<string | undefined> {
		const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, -5);
		const folderPath = `feedback/${timestamp}`;

		// Get the current user for commit attribution
		const user = await this._getCurrentUser(token);
		const username = user?.login ?? 'anonymous';

		// Create a unique branch name for this feedback submission
		const branchName = `feedback/${username}/${timestamp}`;

		// Get the SHA of the main branch to create our branch from
		const mainBranchSha = await this._getBranchSha(token, 'main');
		if (!mainBranchSha) {
			throw new Error('Failed to get main branch SHA');
		}

		// Create the new branch
		await this._createBranch(token, branchName, mainBranchSha);

		// Upload each file to the new branch
		for (const file of files) {
			const filePath = `${folderPath}/${file.name}`;
			await this._createFileInRepo(filePath, file.content, token, username, timestamp, branchName);
		}

		// Create the pull request
		const prUrl = await this._createPullRequest(token, branchName, username, timestamp, files.length);

		return prUrl;
	}

	/**

View on GitHub (pinned to a94b963a32)

When it happens

Trigger: Thrown at extensions/copilot/src/extension/inlineEdits/vscode-node/components/nesFeedbackSubmitter.ts:507 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of microsoft/vscode@a94b963a32 (2026-08-12). Data as JSON: /api/errors/222c576dc334d3d3. Report an issue: GitHub.