Skip to content

Ssh error fix improvements#10769

Closed
mdawoud27 wants to merge 5 commits intotreeverse:mainfrom
mdawoud27:ssh-error-fix-improvements
Closed

Ssh error fix improvements#10769
mdawoud27 wants to merge 5 commits intotreeverse:mainfrom
mdawoud27:ssh-error-fix-improvements

Conversation

@mdawoud27
Copy link
Copy Markdown

Improve SSH Error Messages for Permission vs File Not Found Issues

Description

This PR addresses issue #7861 by improving error handling for SSH operations in the DVC codebase. Currently, when users encounter permission issues with SSH remotes, they incorrectly receive "No such file or directory" errors, which is confusing and makes troubleshooting difficult.

The implementation correctly identifies and maps Paramiko SFTP error codes to appropriate exception types, providing clear, descriptive error messages that distinguish between permission problems and missing files.

Changes

  • Enhanced error handling in SSH filesystem operations (exists, get, put, remove)
  • Added proper error mapping from SFTP error codes to appropriate exceptions
  • Improved error messages with context-specific information
  • Added unit tests to verify the improved error handling

Related Issues

Fixes #7861

Checklist

  • ❗ I have followed the Contributing to DVC checklist.

  • 📖 Documentation update: Since this is a bug fix that improves error messages without changing the API, a separate documentation PR isn't required. However, it might be beneficial to update the troubleshooting guide to mention the improved error messages for SSH remotes.

Thank you for the contribution - we'll try to review it as soon as possible. 🙏

@codecov
Copy link
Copy Markdown

codecov bot commented Jun 8, 2025

Codecov Report

Attention: Patch coverage is 87.77778% with 11 lines in your changes missing coverage. Please review.

Project coverage is 91.04%. Comparing base (2431ec6) to head (84d4c21).
Report is 63 commits behind head on main.

Files with missing lines Patch % Lines
tests/unit/fs/test_ssh_error_messages.py 87.77% 7 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10769      +/-   ##
==========================================
+ Coverage   90.68%   91.04%   +0.36%     
==========================================
  Files         504      505       +1     
  Lines       39795    40091     +296     
  Branches     3141     3164      +23     
==========================================
+ Hits        36087    36502     +415     
+ Misses       3042     2957      -85     
+ Partials      666      632      -34     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@skshetry skshetry closed this Jun 9, 2025
@treeverse treeverse locked as spam and limited conversation to collaborators Jun 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dvc push: misleading error message for SSH remote when SSH user does not have permissions

2 participants