REditorSupport / REditorSupport/vscode-R

Failed to get list of R functions: No method asJSON S3 class: NativeRoutineMap

Open
#1,672 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.2k
Forks
139
Avg merge
2h 46m
Merged PRs (30d)
5

Description

Description

When using the R extension, I consistently receive these error messages:

  1. Failed to get list of R functions. Make sure that jsonlite is installed and r.rpath.windows points to a valid R executable.

  2. R library paths: C:/R_libs/4.5 C:/Program Files/R/R-4.5.2/library Error: No method asJSON S3 class: NativeRoutineMap

The error occurs even when just selecting lines of code in the editor (without executing), suggesting it's triggered by autocomplete/hover features.

Environment

  • OS: Windows 11 x64
  • VS Code version: (1.107.1)
  • vscode-R extension version: 2.8.6
  • R version: 4.5.2 (2025-10-31 ucrt)
  • jsonlite version: 2.0.0
  • languageserver version: 0.3.16

Attempted fixes (none worked)

  1. Added S3 method fix for asJSON.NativeRoutineMap in:

    • ~/.Rprofile
    • Rprofile.site (R's site profile)
    • OneDrive shared .Rprofile
  2. Set R_PROFILE_USER as system environment variable

  3. Configured r.lsp.args: ["--no-save", "--no-restore"]

  4. Reinstalled languageserver from GitHub (remotes::install_github)

  5. Updated jsonlite to 2.0.0

Root cause hypothesis

The languageserver appears to run with --vanilla flag internally, which skips all profile files including Rprofile.site. This prevents any runtime fix from being applied before jsonlite encounters the NativeRoutineMap class.

Suggested fix

Either:

  1. Don't use --vanilla when spawning the languageserver R process, or
  2. Add a built-in handler for NativeRoutineMap class in the extension/languageserver
  3. Use force = TRUE in jsonlite calls (similar to fix in PR #1255)

Minimal reproducible example

The error occurs on any R file when the extension tries to provide autocomplete suggestions.

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 failure in a Windows 11 VS Code R file by triggering autocomplete or hover, then inspect the extension's languageserver process spawning and the configured r.lsp.args. Compare the behavior involving --vanilla, jsonlite, and NativeRoutineMap, and use the reported environment as the baseline. Done means the function-list error no longer appears during autocomplete or hover.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.