You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Debugging internal R functions in RStudio does not go to source #18754
Debugging internal functions in RStudio, inside a function, does not open up R source files to debug, instead printing them to the console
System details
RStudio Edition : Desktop
RStudio Version : 2026.08.2+200
OS Version : "macOS Tahoe 26.5.2"
R Version : R version 4.6.1 (2026-06-24)
Steps to reproduce the problem
debugonce(lm)
lm(bill_dep~., data=penguins)
# works - opens up lm source codefit_lm<-function(data){
lm(bill_dep~., data=data)
}
debugonce(fit_lm)
fit_lm(penguins)
# using `s` to step into `lm` here puts it in the console# similarly, using `debugonce(lm)` once inside the context of `fit_lm()`# does not open up the lm file
debugonce(lm)
fit_lm(penguins)
# this has the same effect as above - it puts the lm() code in the console
Describe the problem in detail
When I debug an internal function, like lm(), I can see the source code in Rstudio:
debugonce(lm)
lm(bill_dep~., data=penguins)
But then if I place that lm() code inside a function, when I go to step into lm() it puts the debugging information in the console:
fit_lm<-function(data){
lm(bill_dep~., data=data)
}
debugonce(fit_lm)
fit_lm(penguins)
# using `s` to step into `lm` here puts it in the console
Activity
fix lost debug highlight inside tryCatch and friends
fix source navigation when debugging nested package functions (#18846)
njtierney commentedon Sep 17, 2026
Thank you very much @kevinushey !
kevinushey commentedon Sep 17, 2026
Our pleasure; thanks for taking the time to report the issue!
njtierney commentedon Oct 19, 2026
Just wanted to say thank you for this again, @kevinushey - tried it now and it works great! :)