Skip to content

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

@bencecc

Description

@bencecc

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 Use force=TRUE when viewing data.frame and list #1255)

Minimal reproducible example

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

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