Skip to content

fix: display reason for git failures#1201

Draft
matthewlouisbrockman wants to merge 7 commits intomainfrom
git-permissions-error-fix
Draft

fix: display reason for git failures#1201
matthewlouisbrockman wants to merge 7 commits intomainfrom
git-permissions-error-fix

Conversation

@matthewlouisbrockman
Copy link
Contributor

@matthewlouisbrockman matthewlouisbrockman commented Mar 13, 2026

Note

Medium Risk
Changes git error classification and introduces new GitPermission* exceptions in both JS and Python SDKs, which can affect downstream error handling and may be a minor breaking behavioral change. Scope is limited to git clone/push/pull failure parsing and messaging.

Overview
Improves git failure reporting by separating filesystem write/permission errors from authentication errors.

Adds GitPermissionError (JS) / GitPermissionException (Python) and updates clone, push, and pull to detect common non-auth permission scenarios (e.g. read-only FS, .git/*.lock, worktree creation) and throw the new error with a clearer remediation message. Auth detection is tightened to treat SSH publickey/403-style failures as auth errors while avoiding generic permission denied matches, and new unit tests cover the new classification.

Written by Cursor Bugbot for commit 615dea7. This will update automatically on new commits. Configure here.

@changeset-bot
Copy link

changeset-bot bot commented Mar 13, 2026

🦋 Changeset detected

Latest commit: b541208

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@e2b/python-sdk Minor
e2b Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Mar 13, 2026

Package Artifacts

Built from f4a0e44. Download artifacts from this workflow run.

JS SDK (e2b@2.14.2-git-permissions-error-fix.0):

npm install ./e2b-2.14.2-git-permissions-error-fix.0.tgz

CLI (@e2b/cli@2.8.2-git-permissions-error-fix.0):

npm install ./e2b-cli-2.8.2-git-permissions-error-fix.0.tgz

Python SDK (e2b==2.15.2+git-permissions-error-fix):

pip install ./e2b-2.15.2+git.permissions.error.fix-py3-none-any.whl

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: SSH password auth errors no longer caught as auth failures
    • Reintroduced a generic SSH auth snippet (permission denied () in both SDK auth detectors and added password-mode regression tests so Permission denied (password). maps to GitAuth errors again.

Create PR

Or push these changes by commenting:

@cursor push e6ee397959
Preview (e6ee397959)
diff --git a/packages/js-sdk/src/sandbox/git/utils.ts b/packages/js-sdk/src/sandbox/git/utils.ts
--- a/packages/js-sdk/src/sandbox/git/utils.ts
+++ b/packages/js-sdk/src/sandbox/git/utils.ts
@@ -516,6 +516,7 @@
     'terminal prompts disabled',
     'could not read username',
     'invalid username or password',
+    'permission denied (',
     'permission denied (publickey',
     'permission denied (keyboard-interactive',
     'permission to ',

diff --git a/packages/js-sdk/tests/sandbox/git/authDetection.test.ts b/packages/js-sdk/tests/sandbox/git/authDetection.test.ts
--- a/packages/js-sdk/tests/sandbox/git/authDetection.test.ts
+++ b/packages/js-sdk/tests/sandbox/git/authDetection.test.ts
@@ -46,6 +46,17 @@
     expect(isAuthFailure(err)).toBe(true)
   })
 
+  test('classifies ssh password failures as auth failures', () => {
+    const err = new CommandExitError({
+      exitCode: 128,
+      error: 'git@github.com: Permission denied (password).',
+      stdout: '',
+      stderr: 'git@github.com: Permission denied (password).',
+    })
+
+    expect(isAuthFailure(err)).toBe(true)
+  })
+
   test('clone raises GitPermissionError for path permission failures', async () => {
     const err = createFilesystemPermissionError(
       "fatal: could not create work tree dir '/home/workspace': Permission denied"

diff --git a/packages/python-sdk/e2b/sandbox/_git/auth.py b/packages/python-sdk/e2b/sandbox/_git/auth.py
--- a/packages/python-sdk/e2b/sandbox/_git/auth.py
+++ b/packages/python-sdk/e2b/sandbox/_git/auth.py
@@ -67,6 +67,7 @@
         "terminal prompts disabled",
         "could not read username",
         "invalid username or password",
+        "permission denied (",
         "permission denied (publickey",
         "permission denied (keyboard-interactive",
         "permission to ",

diff --git a/packages/python-sdk/tests/shared/git/test_auth.py b/packages/python-sdk/tests/shared/git/test_auth.py
--- a/packages/python-sdk/tests/shared/git/test_auth.py
+++ b/packages/python-sdk/tests/shared/git/test_auth.py
@@ -39,6 +39,12 @@
     assert is_auth_failure(err) is True
 
 
+def test_is_auth_failure_detects_ssh_password_errors():
+    err = _command_exit("git@github.com: Permission denied (password).")
+
+    assert is_auth_failure(err) is True
+
+
 class FailingCommands:
     def __init__(self, err: CommandExitException):
         self.err = err

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

'permission denied (publickey',
'permission denied (keyboard-interactive',
'permission to ',
'requested url returned error: 403',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SSH password auth errors no longer caught as auth failures

Medium Severity

Removing the generic 'permission denied' from isAuthFailure and only adding 'permission denied (publickey' and 'permission denied (keyboard-interactive' creates a gap for SSH errors with other auth methods. An error like "Permission denied (password)." matches neither isAuthFailure (no specific SSH method pattern) nor isPermissionFailure (no filesystem context), so it falls through as a generic error instead of being classified as a GitAuthError. This is a regression for servers using password or GSSAPI SSH authentication.

Additional Locations (1)
Fix in Cursor Fix in Web

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants