posit-dev / posit-dev/positron

calling handlers from `.Rprofile` don't persist in session

Open
#6,892 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

area: kernels bug lang: r support
Dominant language
TypeScript
Stars
4.3k
Forks
184
Avg merge
1d 11h
Merged PRs (30d)
206

Description

System details:

Positron and OS details:

Positron Version: 2025.03.0 (Universal) build 116
Code - OSS Version: 1.96.0
Commit: 7f0f93873e8b24c9f393bb3586724f4783c5e72c
Date: 2025-03-01T18:51:44.014Z
Electron: 32.2.6
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Darwin arm64 24.3.0

Interpreter details:

R 4.4.1 or Python 3.11.6

Describe the issue:

If I set calling handlers in my .Rprofile, they aren't applied in my console.

Steps to reproduce the issue:

  1. Run usethis::edit_r_profile() in the R console
  2. Add globalCallingHandlers(error = function(e) stop("Caught that!")) to the end of the file
  3. Restart R
  4. Run R code that errors, e.g. sum(1, "n")
  5. Observe that the calling handler isn't applied, e.g. Error in sum(): ! invalid 'type' (character) of argument rather than Caught that!

Expected or desired behavior:

I would have expected that calling handlers set in .Rprofile are applied in the session. e.g. if I start RStudio with the same .Rprofile, I see:

sum(1, "n")
#> Error in h(simpleError(msg, call)) : Caught that!

Were there any error messages in the UI, Output panel, or Developer Tools console?

No error messages in the UI. The developer tools console is quite busy but they all seem related to specific extensions, so I won't paste that here.

Contributor guide

Open the 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.

Research direction

Reproduce the issue by adding globalCallingHandlers(error = function(e) stop("Caught that!")) through usethis::edit_r_profile(), restarting R, and running sum(1, "n") in the R console. Compare the console startup behavior with RStudio; the work is done when the handler from .Rprofile is applied in the Positron session and the error reports "Caught that!".

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
developer-experience
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.