REditorSupport / REditorSupport/languageserver

Could not start R session, timed out - with renv and language server

Open
#731 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
675
Forks
118
Avg merge
1d 37m
Merged PRs (30d)
11

Description

Trying to get language server to work in latest build of VS Code, R 4.6.0,

Project dependencies are managed with renv. I have verified I have renv installed in both local and project library.

When launching VS Code, I get the following stack trace from the OUTPUT tab for R Language Server:

R Language Server (5068) started
R library paths: F:/Programs/R/R-4.6.0/library

[2026-05-25 23:14:23.818] Error: ! Could not start R session, timed out
Call: [1] "rs_init(self, private, super, options, wait, wait_timeout)"
Stack trace:
1: throw(new_error("Could not start R session, timed out"))
2: rs_init(self, private, super, options, wait, wait_timeout)
3: initialize(...)
4: callr::r_session$new(options = callr::r_session_options(system_profile = TRUE, 
    user_profile = TRUE), wait = TRUE)
5: private$find_or_create_session()
6: self$diagnostics_task_manager$run_tasks()
7: self$process_events()

[2026-05-25 23:14:23.820] exiting

[Error - 11:14:23 PM] Client R Language Server: connection to server is erroring.
read ECONNRESET
[Error - 11:14:23 PM] Client R Language Server: connection to server is erroring.
read ECONNRESET
[Error - 11:14:23 PM] Connection to server got closed. Server will not be restarted.
R Language Server (5068) exited with exit code null

Any ideas? I believe it's due to the renv environment being activated because when I comment out the source file added to my .Rprofile project file, it works fine. But when renv activation script is sourced in .Rprofile (source("renv/activate.R"), it throws this error. I could not find any way to adjust timeout settings. I timed a launch of my CLI (Git Bash), it takes approximately 5 seconds with the activation script. Without the activation sourced, it's essentially instant.

So is it an issue with how long it's taking renv to scan files in my environment? I have added all non .R scripts to my .renvignore to speed the process up.

Contributor guide

No contributing guide indexed for this repository

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 timeout with the project .Rprofile sourcing renv/activate.R, then compare it with the working configuration where that source line is commented out. Start with the R Language Server OUTPUT stack trace and the reported Git Bash launch timings. Done means the language server can start an R session with renv activation enabled, or the cause and required timeout adjustment are documented.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.