`rig pkg install` doesn't show why a package failed when the error happens before `R CMD INSTALL` (e.g. permission denied on the library)

Closed Beginner friendly
#504 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
github-actions, r, rust
Domain
backend, cli

Research direction

Start in src/install.rs at the r_cmd_install() error handling and the install task and main loop links in the issue. Trace how pre-install errors are returned and reported, then compare with the existing R CMD INSTALL failure message. Done when a package’s underlying error and relevant path appear in the normal failure output, including when dependent packages are skipped.

Written by the indexing model from the issue text.

Description

When a package fails to install because of an error before R CMD INSTALL runs, rig pkg install does not say why. The output only has the final count, and the underlying error (here Permission denied) is only visible with -v.

rig 0.11.1 (rig-linux-x86_64-0.11.1.tar.gz), Ubuntu 24.04.

To reproduce, with a library directory the current user cannot write to:

sudo mkdir lib
rig pkg install --library ./lib cli
Installing 1 packages.
[INFO] Installing 1 packages in dependency order with max_concurrent=8
[INFO] Installing package cli from /home/user/.cache/rig/packages/src/cli_3.6.6-f4a1deb1.tar.gz to ./lib
[ERROR] Installation completed: 0 succeeded, 1 failed
Error: Installation completed with 1 failures (0 succeeded)

With rig -v, there is one more line:

[2026-11-05T16:55:00Z DEBUG src/install.rs:838] Install task completed with error for cli: Permission denied (os error 13)

Even then, the path it could not write to is not shown.

With several packages it is harder to follow, as the dependents are reported but not the root failure. This is from our CI on GitHub Actions, where the library was most likely owned by root after a rig proj sync (#503):

[INFO] Installing package htmltools from /home/runner/.cache/rig/packages/src/htmltools_0.5.9.9000-90a5dee5.tar.gz to /home/runner/work/project/tests/.rvenv/lib
[ERROR] Skipping package rmarkdown because a dependency failed
[ERROR] Skipping package bslib because a dependency failed
[ERROR] Skipping package fontawesome because a dependency failed
[ERROR] Skipping package sass because a dependency failed
[INFO] Installing package xfun from /home/runner/.cache/rig/packages/bin/linux/noble-x86_64/4.6/xfun_0.62-4783e8b7.tar.gz to /home/runner/work/project/tests/.rvenv/lib
[ERROR] Skipping package tinytex because a dependency failed
[ERROR] Installation completed: 0 succeeded, 7 failed
Error: Installation completed with 7 failures (0 succeeded)

Nothing says that htmltools and xfun failed, nor why.

From what I can tell, an R CMD INSTALL failure is reported (Failed to install <pkg> with the log path), but any error returned earlier with ? in r_cmd_install(), for example creating <library>/_logs, only reaches the debug!() in the install task, and the main loop drops it:

https://github.com/r-lib/rig/blob/c9df020f02a8b0ab43ccca1f5963700a46800868/src/install.rs#L569-L570

https://github.com/r-lib/rig/blob/c9df020f02a8b0ab43ccca1f5963700a46800868/src/install.rs#L934-L940

https://github.com/r-lib/rig/blob/c9df020f02a8b0ab43ccca1f5963700a46800868/src/install.rs#L983-L985

I tested 0.11.1 only. I see that dc3f23c improved the failure summary on main, but reading the code it looks like these errors are still only logged at debug level there. Please correct me if I'm reading it wrong.

I expected rig to print the error for the package that failed, e.g. Failed to install cli: Permission denied (os error 13) with the path, like it does for an R CMD INSTALL failure.

Dominant language
Rust
Stars
1k
Forks
41
Avg merge
1d 9h
Merged PRs (30d)
13

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from r-lib/rig

All issues in r-lib/rig

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.