Skip to content

Instantly share code, notes, and snippets.

@seanGSISG
Created March 5, 2026 17:46
Show Gist options
  • Select an option

  • Save seanGSISG/4fc416eaf6f1dd4b731053165c72b918 to your computer and use it in GitHub Desktop.

Select an option

Save seanGSISG/4fc416eaf6f1dd4b731053165c72b918 to your computer and use it in GitHub Desktop.
Revert Claude Code to v2.1.68 - Fix Windows trust dialog bug (issue #31156)
# Revert Claude Code to v2.1.68
# Fixes trust dialog bug on Windows (https://github.com/anthropics/claude-code/issues/31156)
$binDir = Join-Path $env:USERPROFILE ".local\bin"
$versionsDir = Join-Path $env:USERPROFILE ".local\share\claude\versions"
$claudeExe = Join-Path $binDir "claude.exe"
$targetVersion = "2.1.68"
# Find the 2.1.68 binary - check versions dir first, then old backups
$source = $null
$versionPath = Join-Path $versionsDir $targetVersion
if (Test-Path $versionPath) {
$source = $versionPath
}
if (-not $source) {
# Look for .old backup files that match the 2.1.68 size (~243MB)
$oldFiles = Get-ChildItem "$binDir\claude.exe.old.*" -ErrorAction SilentlyContinue
foreach ($f in $oldFiles) {
Write-Host "Found backup: $($f.Name) ($([math]::Round($f.Length / 1MB)) MB)"
}
if ($oldFiles.Count -gt 0) {
Write-Host ""
Write-Host "No $targetVersion found in versions directory." -ForegroundColor Yellow
Write-Host "Check backups above and manually copy if one is $targetVersion." -ForegroundColor Yellow
} else {
Write-Host "No $targetVersion binary found. Try: npm install -g @anthropic-ai/claude-code@$targetVersion" -ForegroundColor Red
}
exit 1
}
if (-not (Test-Path $claudeExe)) {
Write-Host "claude.exe not found at $claudeExe" -ForegroundColor Red
exit 1
}
# Back up current version
$bakPath = "$claudeExe.pre-revert.bak"
Copy-Item $claudeExe $bakPath -Force
Write-Host "Backed up current claude.exe -> $bakPath"
# Copy 2.1.68
Copy-Item $source $claudeExe -Force
Write-Host "Reverted claude.exe to $targetVersion"
# Disable auto-updates so it doesn't upgrade back
$configPath = Join-Path $env:USERPROFILE ".claude.json"
if (Test-Path $configPath) {
$config = Get-Content $configPath -Raw | ConvertFrom-Json
$config.autoUpdates = $false
$config | ConvertTo-Json -Depth 100 | Set-Content $configPath -Encoding UTF8
Write-Host "Disabled auto-updates in .claude.json"
}
Write-Host ""
Write-Host "Done! Restart your terminal and run 'claude' to verify." -ForegroundColor Green
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment