Skip to content

.rs.exprMutatesPackageLibrary errors after evaluating a [ subset with an empty argument followed by a non-empty one (e.g. mtcars[, 1:3]) #18230

Closed

Description

@jdrnevich

.rs.exprMutatesPackageLibrary errors after evaluating a [ subset with an empty argument followed by a non-empty one (e.g. mtcars[, 1:3])

System details

  • RStudio Edition: Desktop
  • RStudio Version: 2026.07.0 Build 139
  • OS: Windows 11 (x86_64)
  • R Version: 4.6.0 (2026-04-24 ucrt) — Platform: x86_64-w64-mingw32/x64

Summary

After evaluating any top-level command whose parse tree contains a [ call with an empty argument immediately followed by a non-empty argument — the very common x[, cols] idiom — RStudio prints the correct result and then throws:

Error in .rs.exprMutatesPackageLibrary(part) : 
  argument "part" is missing, with no default

The command itself runs correctly; the output appears before the error. The error comes from RStudio's post-command processing, not from R. It does not occur in a plain R session (Rgui / R console) on the same machine and same R version — only in RStudio — which points to the IDE's internal code rather than R or user code.

Steps to reproduce

In a fresh RStudio session, at the console:

head(mtcars[, 1:3])

The subset prints correctly, then the error appears immediately after.

Expected behavior

The subset result prints with no subsequent error, matching the behavior of a plain R session.

Actual behavior

Correct output, followed by:

Error in .rs.exprMutatesPackageLibrary(part) : 
  argument "part" is missing, with no default

Minimal contrast (narrowing the trigger)

The trigger is specifically an empty argument followed by a non-empty argument inside the same [ call. All tested in one session immediately after startup:

Command Argument pattern Result
mtcars[, 1:3] empty row, then non-empty column error
mtcars[, ] empty, then empty ok
mtcars[1:5, ] non-empty, then trailing empty ok
mtcars[1:5, 1:3] no empty argument ok
mtcars[] single empty argument ok
mtcars[1:3] single non-empty argument (no comma) ok

So a trailing empty argument is handled fine; the error requires an empty argument with a non-empty argument positioned after it.

Likely cause (hypothesis)

x[, 1:3] parses to a [ call whose second element is R's empty (missing) symbol:

as.list(quote(mtcars[, 1:3]))
# [[1]] `[`
# [[2]] mtcars
# [[3]]            <- empty / missing symbol (R_MissingArg)
# [[4]] 1:3

It appears the argument walker inside .rs.exprMutatesPackageLibrary recurses over the call's arguments and forces the empty (missing) argument when a further argument follows it, yielding "argument … is missing, with no default." A trailing empty seems to be handled because nothing after it forces evaluation.

Impact

x[, cols] (all rows, selected columns) is one of the most common base-R subsetting idioms, so this fires during ordinary interactive use after a large fraction of commands. It is cosmetic — results are correct — but the spurious error is disruptive and clutters console output. It was originally hit with a real command of the form df[, c(2:5, 17:20)].

Possibly related (may be a separate issue)

On this same build, Session > Restart R produced a popup dialog: "Terminal Reconnection Failure — jsonrpc error 6 (Invalid json-rpc request)". Both this and the error above involve the front-end ↔ rsession RPC layer, so noting it in case it shares a root cause. Feel free to disregard if unrelated.

  • [ x] I have read the guide for submitting good bug reports.
  • [ x] I have installed the latest version of RStudio, and confirmed that the issue still persists.
  • [ x] If I am reporting an RStudio crash, I have included a diagnostics report.
  • [x ] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

Activity

  1. kevinushey commented on Jul 14, 2026

    @kevinushey
    Collaborator

    Thanks for the bug report -- I believe this is fixed in the latest daily builds at https://dailies.rstudio.com/, although it's unfortunate that this slipped through into our most recent release.

  2. added theissue type on Jul 14, 2026
  3. added this to the Patch 2026.07.1 milestone on Jul 15, 2026
  4. doc-dog-ai commented on Jul 16, 2026

    @doc-dog-ai

    I confirm that it is a problem with RSstudio 2026.07.0 build 139. Because the subset() function works, or if you go back to the version RStudio-2026.05.1-225, the issue has been resolved in this version.

  5. jdrnevich commented on Jul 16, 2026

    @jdrnevich
    Author

    Ok, I've rolled back to RStudio-2026.05.1-225 for now. I was actually happy to see that 2026.07.0-139 was released because 2026.06.0-242 was acting very weird and slow. I've ignored the update for now, but I assume once the next one is out I will get a new update notice, or should I check periodically?

  6. kevinushey commented on Jul 16, 2026

    @kevinushey
    Collaborator

    Currently, the plan is to prepare a patch release early next week; in the interim, test builds are available at https://dailies.rstudio.com/rstudio/pacific-dogwood/.

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

Metadata

Metadata

Assignees

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions