REditorSupport / REditorSupport/vscode-R
R linter fails with normalizePath() empty path error in callr subprocess
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 139
- Avg merge
- 2h 46m
- Merged PRs (30d)
- 5
Description
Describe the bug
The R linter fails with a normalizePath() error when trying to lint R files, showing "path[1]="": Impossibile trovare il percorso specificato" (Cannot find the specified path). The error occurs in a callr subprocess and prevents the linter from running, even though the R code itself has no linting issues when run directly.
To Reproduce
Steps to reproduce the behavior:
- Create an R file (e.g., setup_r_dependencies.R) with valid R code
- Open the file in VS Code with the R extension enabled
- The extension automatically attempts to run diagnostics
- See error in the Problems panel: Failed to run diagnostics: ! in callr subprocess. Caused by error in lintr::lint(path, cache = cache, text = content): ! Linter linter() failed in '': Caused by error in normalizePath(): ! path[1]="": Impossibile trovare il percorso specificato
Can you fix this issue by yourself? (We appreciate the help)
No - this appears to be an internal issue with how the extension handles file paths when calling the lintr subprocess.
(If applicable) Please attach setting.json
// Default R extension settings - no custom configuration
"r.rterm.windows": "",
"r.rterm.mac": "/usr/local/bin/R",
"r.rterm.linux": "/usr/bin/R",
"r.rterm.option": [],
"r.source.encoding": "UTF-8",
"r.source.focus": "editor",
"r.alwaysUseActiveTerminal": false,
"r.bracketedPaste": false,
"r.sessionWatcher": true,
"r.rtermSendDelay": 8,
Expected behavior
The linter should run without errors and provide appropriate linting feedback. When running lintr::lint('setup_r_dependencies.R') directly in R, it works correctly and reports "No lints found."
Environment (please complete the following information):
OS: Windows
VSCode Version: [your VS Code version]
R Version: 4.5.0 (2025-04-11 ucrt)
vscode-R version: [your extension version]
Additional context
The error message is in Italian, suggesting it may be related to locale handling: "Impossibile trovare il percorso specificato" = "Cannot find the specified path"
Direct testing shows the issue is isolated to the VS Code extension's linter integration:
- (ok) lintr::lint('setup_r_dependencies.R') works fine in R console
- (ok) callr::r(function() { lintr::lint('setup_r_dependencies.R') }) works fine in R console
- (bug) VS Code extension fails with empty path error
The error suggests the extension is passing an empty string (path[1]="") to normalizePath(), indicating a path resolution bug in the extension's linter integration
File has proper encoding headers and no unusual characters
No R configuration files (.Rprofile, .Renviron) that could interfere
The R code itself is syntactically correct and functional
The core issue appears to be that the extension is somehow passing an empty file path string to the lintr subprocess, causing normalizePath() to fail.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Windows failure through the VS Code diagnostics path, then trace the extension's callr subprocess invocation of lintr::lint and the file-path value passed to it. Compare this with the direct lintr::lint and callr tests described in the report. Done means R diagnostics run without the empty-path normalizePath() error and still report lint feedback.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r, typescript, vscode
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100