Skip to content

fix: gracefully skip permission-denied errors during project scan#24

Merged
utkarsh232005 merged 1 commit into
KDM-cli:mainfrom
utkarsh232005:fix/skip-permission-denied-during-scan
Jun 1, 2026
Merged

fix: gracefully skip permission-denied errors during project scan#24
utkarsh232005 merged 1 commit into
KDM-cli:mainfrom
utkarsh232005:fix/skip-permission-denied-during-scan

Conversation

@utkarsh232005
Copy link
Copy Markdown
Member

Problem

When running kdc from the home directory or any directory containing macOS-protected folders (like ~/Music, ~/Photos, etc.), the project scanner fails with:

Error: IO error for operation on /Users/.../Music/Music: Operation not permitted (os error 1)

This happens because:

  1. kdc defaults to scanning the current directory (.) when no --project path is provided
  2. The scanner uses WalkDir and propagates all errors via entry?
  3. macOS sandboxing denies access to certain user folders, causing the scan to fail entirely

Fix

Change the scanner to skip entries that fail with permission errors instead of propagating the error and aborting the scan:

let entry = match entry {
    Ok(e) => e,
    Err(err) => {
        tracing::debug!("Skipping inaccessible path: {}", err);
        continue;
    }
};

This allows kdc to:

  • Continue scanning accessible directories
  • Log inaccessible paths at debug level for troubleshooting
  • Work correctly when run from the home directory or other locations with protected subdirectories

Result

kdc now runs successfully from any directory, including ~, without failing on permission-denied errors.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 1, 2026

Warning

Review limit reached

@utkarsh232005, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 28 minutes and 56 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e9ff2526-7755-40b4-a7ab-fc2b91228746

📥 Commits

Reviewing files that changed from the base of the PR and between d15fa59 and 2583105.

📒 Files selected for processing (1)
  • src/project/scanner.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@utkarsh232005 utkarsh232005 merged commit c051338 into KDM-cli:main Jun 1, 2026
3 checks passed
Copy link
Copy Markdown

@codescene-delta-analysis codescene-delta-analysis Bot left a comment

Choose a reason for hiding this comment

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

Gates Passed
3 Quality Gates Passed

See analysis details in CodeScene

Quality Gate Profile: The Bare Minimum
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 1, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/project/scanner.rs 50.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

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.

1 participant