Skip to content

fix: catch permission errors when copying custom Dockerfile build context (#1808) - #1931

Merged
cv merged 1 commit into
mainfrom
fix/dockerfile-context-permission-error
Apr 15, 2026
Merged

fix: catch permission errors when copying custom Dockerfile build context (#1808)#1931
cv merged 1 commit into
mainfrom
fix/dockerfile-context-permission-error

Conversation

@zyang-dev

@zyang-dev zyang-dev commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Summary

When nemoclaw onboard --from Dockerfile is run in a directory with unreadable files (e.g., a user's home directory on WSL with Windows system files), the build context copy crashes with a raw Node.js stack trace. This catches the EACCES error and shows a clear message telling the user to move the Dockerfile to a dedicated directory.

Related Issue

Fixes #1808

Changes

  • src/lib/onboard.ts: Wrap the build context fs.cpSync call in a try/catch. On EACCES, print an actionable error message and exit instead of crashing with a stack trace.

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with doc updates
  • Doc only (prose changes, no code sample modifications)
  • Doc only (includes code sample changes)

Verification

  • npx prek run --all-files passes
  • npm test passes
  • Tests added or updated for new or changed behavior
  • No secrets, API keys, or credentials committed
  • Docs updated for user-facing behavior changes
  • make docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

AI Disclosure

  • AI-assisted — tool: Claude Code

Signed-off-by: zyang-dev 267119621+zyang-dev@users.noreply.github.com

Summary by CodeRabbit

  • Bug Fixes
    • Improved error handling for permission-denied scenarios during the build process. When a permission issue occurs, users now receive a clear error message with actionable guidance on how to resolve the problem.

…text (#1808)

Signed-off-by: zyang-dev <267119621+zyang-dev@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 84d739b1-0ba5-4c1f-a9cc-afee66e11891

📥 Commits

Reviewing files that changed from the base of the PR and between e885982 and ca53f0e.

📒 Files selected for processing (1)
  • src/lib/onboard.ts

📝 Walkthrough

Walkthrough

A permission-denied error handler was added to the Docker build context copy operation in createSandbox. When an EACCES error occurs, the code logs a diagnostic message instructing users to relocate their Dockerfile to a dedicated directory, then terminates gracefully. Non-permission errors are rethrown.

Changes

Cohort / File(s) Summary
Error handling for Docker build context copy
src/lib/onboard.ts
Wrapped synchronous directory copy in try/catch to handle EACCES permission errors with a user-friendly message explaining that the --from Dockerfile parent directory is used as build context and recommending relocation of the Dockerfile to a dedicated directory.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Poem

🐰 A permission denied? No fear, dear friend!
The rabbit ensures the error message'll mend—
Move your Dockerfile, so the copy can flow,
No more cryptic crashes, just graceful "let's go!"

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically identifies the main fix: catching permission errors when copying custom Dockerfile build context, directly addressing the core change in the code.
Linked Issues check ✅ Passed The PR successfully addresses the core requirement from issue #1808: wrapping the build context copy in try/catch to handle EACCES errors with an actionable error message and graceful exit.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the permission error handling in the createSandbox function, with no unrelated modifications present.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/dockerfile-context-permission-error

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

@cv
cv merged commit bf99008 into main Apr 15, 2026
14 checks passed
miyoungc added a commit that referenced this pull request Apr 16, 2026
## Summary
- Add "Ollama network exposure warning during onboard" troubleshooting
entry (from #1877)
- Document snapshot restore liveness preflight and clean restore
behavior (from #1901)
- Update Jetson troubleshooting for BSP R39+ support (from #1910)
- Document `--from` Dockerfile permission error handling (from #1931)
- Bump doc version switcher through 0.0.17
- Regenerate agent skills from updated docs

## Test plan
- [x] `make docs` builds without warnings
- [x] All pre-commit hooks pass
- [ ] Verify rendered pages in docs build output

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Documentation**
* Clarified onboarding error when build context contains unreadable
files.
* Updated snapshot restore: sandbox must be running; restore cleanly
replaces state directories and removes files added after the snapshot.
  * Added Jetson BSP R39 automatic configuration guidance.
* Added Ollama network-exposure security guidance for local provider
selection during onboarding.
* **Documentation (versions)**
* Added docs entry for version 0.0.17 and updated project docs version.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@zyang-dev
zyang-dev deleted the fix/dockerfile-context-permission-error branch April 17, 2026 17:58
@wscurran wscurran added the bug-fix PR fixes a bug or regression label Jun 8, 2026
@wscurran wscurran added NV QA Bugs found by the NVIDIA QA Team UAT Issues flagged for User Acceptance Testing. labels Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix PR fixes a bug or regression NV QA Bugs found by the NVIDIA QA Team UAT Issues flagged for User Acceptance Testing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[WSL2] Onboard from Dockerfile fails

3 participants