Skip to content

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

@bk1n

Description

@bk1n

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions