posit-dev / posit-dev/positron

R Interpreter fails to start on windows - Failed to convert R home to utf-8

Open
#4,374 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug lang: r support
Dominant language
TypeScript
Stars
4.3k
Forks
184
Avg merge
1d 9h
Merged PRs (30d)
195

Description

System details:

Positron and OS details:

Positron Version: 2024.08.0 (user setup) build 31
Code - OSS Version: 1.91.0
Commit: 7ee0596b81d578059e63c9af7c535c6b6040b947
Date: 2024-08-10T13:58:54.164Z
Electron: 29.4.0
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Windows_NT x64 10.0.14393

Interpreter details:

R4.2.3

Describe the issue:

When starting up positron it fails to launch the R interpreter with:

R 4.2.3 starting.
R 4.2.3 failed to start up (exit code 0)

Then when I press the start console button I get the error and stacktrace below.

Steps to reproduce the issue:

Install positron from latest release on github 2024.08.0 build 31 and start it.

Expected or desired behavior:

Launches the R interpreter succesfully.

Were there any error messages in the UI, Output panel, or Developer Tools console?

Error in R console when starting R console manually:

Error: Socket disposed
e:\efridgeirsson\Positron\resources\app\extensions\positron-r\resources\ark\ark.exe --connection_file C:\Users\ADC59E~1\AppData\Local\Temp\2\kernel-9l6jwA\connection.json --log C:\Users\ADC59E~1\AppData\Local\Temp\2\kernel-9l6jwA\kernel.log --startup-file e:\efridgeirsson\Positron\resources\app\extensions\positron-r\resources\scripts\startup.R --session-mode console -- --interactive --no-restore-data 
  2024-08-16T09:02:45.848967Z ERROR  Panic! In file 'crates\ark\src\sys\windows\interface.rs' at line 134: Failed to convert R home to UTF-8. Path 'C:\Program Files\R\R-4.2.3'. Error: [87] The parameter is incorrect.

Stack backtrace:
   0: <unknown>
   1: <unknown>
   2: tree_sitter_r
   3: <unknown>
   4: <unknown>
   5: <unknown>
   6: <unknown>
   7: <unknown>
   8: <unknown>
   9: <unknown>
  10: <unknown>
  11: tree_sitter_r
  12: BaseThreadInitThunk
  13: RtlUserThreadStart.

Backtrace:
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: <unknown>
   5: <unknown>
   6: <unknown>
   7: <unknown>
   8: tree_sitter_r
   9: <unknown>
  10: <unknown>
  11: <unknown>
  12: <unknown>
  13: <unknown>
  14: <unknown>
  15: <unknown>
  16: tree_sitter_r
  17: BaseThreadInitThunk
  18: RtlUserThreadStart

   at crates\ark\src/main.rs:482
Output from Positron R extension output channel
2024-08-16 05:00:26.445 [info] Log level: Debug
2024-08-16 05:00:26.445 [info] Checking for 'InstallPath' in registry key \Software\R-Core\R64 for hive HKCU
2024-08-16 05:00:26.446 [info] Refreshing testthat status
2024-08-16 05:00:26.446 [info] Not working in an R package
2024-08-16 05:00:26.446 [info] Context key 'testthatIsConfigured' is 'false'
2024-08-16 05:00:26.446 [info] Context key 'testthatHasTests' is 'false'
2024-08-16 05:00:27.829 [info] Unable to get value of 'InstallPath': QUERY command exited with code 1:

ERROR: The system was unable to find the specified registry key or value.
2024-08-16 05:00:28.178 [info] Checking for 'InstallPath' in registry key \Software\WOW6432Node\R-Core\R64 for hive HKCU
2024-08-16 05:00:28.932 [info] Unable to get value of 'InstallPath': QUERY command exited with code 1:

ERROR: The system was unable to find the specified registry key or value.
2024-08-16 05:00:29.291 [info] Checking for 'InstallPath' in registry key \Software\R-Core\R64 for hive HKLM
2024-08-16 05:00:30.331 [info] Identified the current version of R from the registry: C:\Program Files\R\R-4.2.3\bin\x64\R.exe
2024-08-16 05:00:30.368 [info] Candidate R binary at C:\Program Files\R\R-4.2.3\bin\x64\R.exe
2024-08-16 05:00:30.368 [info] R installation discovered: {
  "valid": true,
  "supported": true,
  "binpath": "C:\\Program Files\\R\\R-4.2.3\\bin\\x64\\R.exe",
  "homepath": "C:\\Program Files\\R\\R-4.2.3",
  "semVersion": {
    "options": {},
    "loose": false,
    "includePrerelease": false,
    "raw": "4.2.3",
    "major": 4,
    "minor": 2,
    "patch": 3,
    "prerelease": [],
    "build": [],
    "version": "4.2.3"
  },
  "version": "4.2.3",
  "arch": "x86_64",
  "current": true,
  "orthogonal": true
}
2024-08-16 05:00:41.432 [info] Checking for 'InstallPath' in registry key \Software\R-Core\R64 for hive HKCU
2024-08-16 05:00:42.046 [info] Unable to get value of 'InstallPath': QUERY command exited with code 1:

ERROR: The system was unable to find the specified registry key or value.
2024-08-16 05:00:42.255 [info] Checking for 'InstallPath' in registry key \Software\WOW6432Node\R-Core\R64 for hive HKCU
2024-08-16 05:00:42.786 [info] Unable to get value of 'InstallPath': QUERY command exited with code 1:

ERROR: The system was unable to find the specified registry key or value.
2024-08-16 05:00:42.980 [info] Checking for 'InstallPath' in registry key \Software\R-Core\R64 for hive HKLM
2024-08-16 05:00:43.440 [info] Identified the current version of R from the registry: C:\Program Files\R\R-4.2.3\bin\x64\R.exe
2024-08-16 05:00:43.461 [info] Candidate R binary at C:\Program Files\R\R-4.2.3\bin\x64\R.exe
2024-08-16 05:00:43.461 [info] R installation discovered: {
  "valid": true,
  "supported": true,
  "binpath": "C:\\Program Files\\R\\R-4.2.3\\bin\\x64\\R.exe",
  "homepath": "C:\\Program Files\\R\\R-4.2.3",
  "semVersion": {
    "options": {},
    "loose": false,
    "includePrerelease": false,
    "raw": "4.2.3",
    "major": 4,
    "minor": 2,
    "patch": 3,
    "prerelease": [],
    "build": [],
    "version": "4.2.3"
  },
  "version": "4.2.3",
  "arch": "x86_64",
  "current": true,
  "orthogonal": true
}
2024-08-16 05:00:43.461 [info] Candidate R binary at C:\Program Files\R\R-4.0.3\bin\x64\R.exe
2024-08-16 05:00:43.461 [info] R installation discovered: {
  "valid": true,
  "supported": false,
  "binpath": "C:\\Program Files\\R\\R-4.0.3\\bin\\x64\\R.exe",
  "homepath": "C:\\Program Files\\R\\R-4.0.3",
  "semVersion": {
    "options": {},
    "loose": false,
    "includePrerelease": false,
    "raw": "4.0.3",
    "major": 4,
    "minor": 0,
    "patch": 3,
    "prerelease": [],
    "build": [],
    "version": "4.0.3"
  },
  "version": "4.0.3",
  "arch": "x86_64",
  "current": false,
  "orthogonal": true
}
2024-08-16 05:00:43.462 [info] Candidate R binary at C:\Program Files\R\R-4.2.1\bin\x64\R.exe
2024-08-16 05:00:43.462 [info] R installation discovered: {
  "valid": true,
  "supported": true,
  "binpath": "C:\\Program Files\\R\\R-4.2.1\\bin\\x64\\R.exe",
  "homepath": "C:\\Program Files\\R\\R-4.2.1",
  "semVersion": {
    "options": {},
    "loose": false,
    "includePrerelease": false,
    "raw": "4.2.1",
    "major": 4,
    "minor": 2,
    "patch": 1,
    "prerelease": [],
    "build": [],
    "version": "4.2.1"
  },
  "version": "4.2.1",
  "arch": "x86_64",
  "current": false,
  "orthogonal": true
}
2024-08-16 05:00:43.462 [info] Filtering out C:\Program Files\R\R-4.0.3\bin\x64\R.exe: version is < 4.2.0
2024-08-16 05:00:58.579 [info] Log level: Debug
2024-08-16 05:00:58.579 [info] Refreshing testthat status
2024-08-16 05:00:58.579 [info] Not working in an R package
2024-08-16 05:00:58.579 [info] Context key 'testthatIsConfigured' is 'false'
2024-08-16 05:00:58.580 [info] Context key 'testthatHasTests' is 'false'
2024-08-16 05:00:59.649 [info] Checking for 'InstallPath' in registry key \Software\R-Core\R64 for hive HKCU
2024-08-16 05:01:00.525 [info] Unable to get value of 'InstallPath': QUERY command exited with code 1:

ERROR: The system was unable to find the specified registry key or value.
2024-08-16 05:01:00.728 [info] Checking for 'InstallPath' in registry key \Software\WOW6432Node\R-Core\R64 for hive HKCU
2024-08-16 05:01:01.299 [info] Unable to get value of 'InstallPath': QUERY command exited with code 1:

ERROR: The system was unable to find the specified registry key or value.
2024-08-16 05:01:01.518 [info] Checking for 'InstallPath' in registry key \Software\R-Core\R64 for hive HKLM
2024-08-16 05:01:02.117 [info] Identified the current version of R from the registry: C:\Program Files\R\R-4.2.3\bin\x64\R.exe
2024-08-16 05:01:02.130 [info] Candidate R binary at C:\Program Files\R\R-4.2.3\bin\x64\R.exe
2024-08-16 05:01:02.130 [info] R installation discovered: {
  "valid": true,
  "supported": true,
  "binpath": "C:\\Program Files\\R\\R-4.2.3\\bin\\x64\\R.exe",
  "homepath": "C:\\Program Files\\R\\R-4.2.3",
  "semVersion": {
    "options": {},
    "loose": false,
    "includePrerelease": false,
    "raw": "4.2.3",
    "major": 4,
    "minor": 2,
    "patch": 3,
    "prerelease": [],
    "build": [],
    "version": "4.2.3"
  },
  "version": "4.2.3",
  "arch": "x86_64",
  "current": true,
  "orthogonal": true
}
2024-08-16 05:01:02.130 [info] Candidate R binary at C:\Program Files\R\R-4.0.3\bin\x64\R.exe
2024-08-16 05:01:02.130 [info] R installation discovered: {
  "valid": true,
  "supported": false,
  "binpath": "C:\\Program Files\\R\\R-4.0.3\\bin\\x64\\R.exe",
  "homepath": "C:\\Program Files\\R\\R-4.0.3",
  "semVersion": {
    "options": {},
    "loose": false,
    "includePrerelease": false,
    "raw": "4.0.3",
    "major": 4,
    "minor": 0,
    "patch": 3,
    "prerelease": [],
    "build": [],
    "version": "4.0.3"
  },
  "version": "4.0.3",
  "arch": "x86_64",
  "current": false,
  "orthogonal": true
}
2024-08-16 05:01:02.130 [info] Candidate R binary at C:\Program Files\R\R-4.2.1\bin\x64\R.exe
2024-08-16 05:01:02.130 [info] R installation discovered: {
  "valid": true,
  "supported": true,
  "binpath": "C:\\Program Files\\R\\R-4.2.1\\bin\\x64\\R.exe",
  "homepath": "C:\\Program Files\\R\\R-4.2.1",
  "semVersion": {
    "options": {},
    "loose": false,
    "includePrerelease": false,
    "raw": "4.2.1",
    "major": 4,
    "minor": 2,
    "patch": 1,
    "prerelease": [],
    "build": [],
    "version": "4.2.1"
  },
  "version": "4.2.1",
  "arch": "x86_64",
  "current": false,
  "orthogonal": true
}
2024-08-16 05:01:02.130 [info] Filtering out C:\Program Files\R\R-4.0.3\bin\x64\R.exe: version is < 4.2.0
Console: R 4.2.3 Output Channels ```text 2024-08-16 05:00:39.427 [info] [Positron] Connecting to R 4.2.3 kernel (pid 10808) 2024-08-16 05:00:39.427 [info] [Positron] Streaming log file: C:\Users\ADC59E~1\AppData\Local\Temp\2\kernel-2mDzn1\kernel.log 2024-08-16 05:00:39.427 [info] [Positron] Connecting to kernel sockets defined in C:\Users\ADC59E~1\AppData\Local\Temp\2\kernel-2mDzn1\connection.json... 2024-08-16 05:00:39.427 [info] [Positron] Control socket created (count = 1) 2024-08-16 05:00:39.427 [info] [Positron] Shell socket created (count = 2) 2024-08-16 05:00:39.428 [info] [Positron] Stdin socket created (count = 3) 2024-08-16 05:00:39.432 [info] [Positron] I/O socket created (count = 4) 2024-08-16 05:00:39.432 [info] [Positron] Heartbeat socket created (count = 5) 2024-08-16 05:00:39.432 [info] [Positron] Control socket connecting to tcp://127.0.0.1:51789... 2024-08-16 05:00:39.432 [info] [Positron] Shell socket connecting to tcp://127.0.0.1:64749... 2024-08-16 05:00:39.432 [info] [Positron] Stdin socket connecting to tcp://127.0.0.1:61882... 2024-08-16 05:00:39.432 [info] [Positron] I/O socket connecting to tcp://127.0.0.1:41961... 2024-08-16 05:00:39.432 [info] [Positron] Heartbeat socket connecting to tcp://127.0.0.1:62386... 2024-08-16 05:00:39.432 [info] [Positron] Shell socket connected to tcp://127.0.0.1:64749 2024-08-16 05:00:39.433 [info] [Positron] I/O socket connected to tcp://127.0.0.1:41961 2024-08-16 05:00:39.433 [info] [Positron] Heartbeat socket connected to tcp://127.0.0.1:62386 2024-08-16 05:00:39.433 [info] [R] *** Log started at Fri 08/16/2024 5:00:36.62 2024-08-16 05:00:39.433 [info] [R] *** Command line: 2024-08-16 05:00:39.433 [info] [R] e:\efridgeirsson\Positron\resources\app\extensions\positron-r\resources\ark\ark.exe --connection_file C:\Users\ADC59E~1\AppData\Local\Temp\2\kernel-2mDzn1\connection.json --log C:\Users\ADC59E~1\AppData\Local\Temp\2\kernel-2mDzn1\kernel.log --startup-file e:\efridgeirsson\Positron\resources\app\extensions\positron-r\resources\scripts\startup.R --session-mode console -- --interactive --no-restore-data 2024-08-16 05:00:39.433 [info] [Positron] Control socket connected to tcp://127.0.0.1:51789 2024-08-16 05:00:39.433 [info] [Positron] Stdin socket connected to tcp://127.0.0.1:61882 2024-08-16 05:00:39.433 [info] [Positron] Establishing socket listeners... [Positron] Shell socket disconnected from tcp://127.0.0.1:64749 [Positron] I/O socket disconnected from tcp://127.0.0.1:41961 [Positron] Heartbeat socket disconnected from tcp://127.0.0.1:62386 [Positron] Control socket disconnected from tcp://127.0.0.1:51789 [Positron] Stdin socket disconnected from tcp://127.0.0.1:61882 [Positron] All 5 sockets disconnected; kernel exited [Positron] Last line of log file C:\Users\ADC59E~1\AppData\Local\Temp\2\kernel-2mDzn1\kernel.log does't name an exit code: Process exit code -1073740791

[R] 2: tree_sitter_r
[R] 3:
[R] 4:
[R] 5:
[R] 6:
[R] 7:
[R] 8:
[R] 9:
[R] 10:
[R] 11: tree_sitter_r
[R] 12: BaseThreadInitThunk
[R] 13: RtlUserThreadStart.
[R]
[R] Backtrace:
[R] 0:
[R] 1:
[R] 2:
[R] 3:
[R] 4:
[R] 5:
[R] 6:
[R] 7:
[R] 8: tree_sitter_r
[R] 9:
[R] 10:
[R] 11:
[R] 12:
[R] 13:
[R] 14:
[R] 15:
[R] 16: tree_sitter_r
[R] 17: BaseThreadInitThunk
[R] 18: RtlUserThreadStart
[R]
[R] at crates\ark\src/main.rs:482
[R]
[R] *** Log ended at Fri 08/16/2024 5:00:40.00

[R] Process exit code -1073740791

[R]
[Positron] R kernel status changed: starting => exited
2024-08-16 05:01:33.956 [info] [Positron] Connecting to R 4.2.3 kernel (pid 10936)
2024-08-16 05:01:33.957 [info] [Positron] Streaming log file: C:\Users\ADC59E1\AppData\Local\Temp\2\kernel-WmGBxr\kernel.log
2024-08-16 05:01:33.957 [info] [Positron] Connecting to kernel sockets defined in C:\Users\ADC59E
1\AppData\Local\Temp\2\kernel-WmGBxr\connection.json...
2024-08-16 05:01:33.957 [info] [Positron] Control socket created (count = 1)
2024-08-16 05:01:33.957 [info] [Positron] Shell socket created (count = 2)
2024-08-16 05:01:33.957 [info] [Positron] Stdin socket created (count = 3)
2024-08-16 05:01:33.957 [info] [Positron] I/O socket created (count = 4)
2024-08-16 05:01:33.957 [info] [Positron] Heartbeat socket created (count = 5)
2024-08-16 05:01:33.957 [info] [Positron] Control socket connecting to tcp://127.0.0.1:44876...
2024-08-16 05:01:33.957 [info] [Positron] Shell socket connecting to tcp://127.0.0.1:58116...
2024-08-16 05:01:33.958 [info] [Positron] Stdin socket connecting to tcp://127.0.0.1:65203...
2024-08-16 05:01:33.958 [info] [Positron] I/O socket connecting to tcp://127.0.0.1:46481...
2024-08-16 05:01:33.958 [info] [Positron] Heartbeat socket connecting to tcp://127.0.0.1:63833...
2024-08-16 05:01:33.958 [info] [R] *** Log started at Fri 08/16/2024 5:01:33.27
2024-08-16 05:01:33.958 [info] [R] *** Command line:
2024-08-16 05:01:33.958 [info] [R] e:\efridgeirsson\Positron\resources\app\extensions\positron-r\resources\ark\ark.exe --connection_file C:\Users\ADC59E1\AppData\Local\Temp\2\kernel-WmGBxr\connection.json --log C:\Users\ADC59E1\AppData\Local\Temp\2\kernel-WmGBxr\kernel.log --startup-file e:\efridgeirsson\Positron\resources\app\extensions\positron-r\resources\scripts\startup.R --session-mode console -- --interactive --no-restore-data
[Positron] Control socket still connecting (2s)
[Positron] Shell socket still connecting (2s)
[Positron] Stdin socket still connecting (2s)
[Positron] I/O socket still connecting (2s)
[Positron] Heartbeat socket still connecting (2s)
[Positron] Shell socket connected to tcp://127.0.0.1:58116
[Positron] Shell socket disconnected from tcp://127.0.0.1:58116
[Positron] All 5 sockets disconnected; kernel exited
[Positron] Last line of log file C:\Users\ADC59E~1\AppData\Local\Temp\2\kernel-WmGBxr\kernel.log does't name an exit code: Process exit code -1073740791

[R] 2: tree_sitter_r
[R] 3:
[R] 4:
[R] 5:
[R] 6:
[R] 7:
[R] 8:
[R] 9:
[R] 10:
[R] 11: tree_sitter_r
[R] 12: BaseThreadInitThunk
[R] 13: RtlUserThreadStart.
[R]
[R] Backtrace:
[R] 0:
[R] 1:
[R] 2:
[R] 3:
[R] 4:
[R] 5:
[R] 6:
[R] 7:
[R] 8: tree_sitter_r
[R] 9:
[R] 10:
[R] 11:
[R] 12:
[R] 13:
[R] 14:
[R] 15:
[R] 16: tree_sitter_r
[R] 17: BaseThreadInitThunk
[R] 18: RtlUserThreadStart
[R]
[R] at crates\ark\src/main.rs:482
[R]
[R] *** Log ended at Fri 08/16/2024 5:01:34.83

[R] Process exit code -1073740791

[R]
[Positron] R kernel status changed: starting => exited
[Positron] Connecting to R 4.2.3 kernel (pid 5680)
[Positron] Streaming log file: C:\Users\ADC59E1\AppData\Local\Temp\2\kernel-9l6jwA\kernel.log
[Positron] Connecting to kernel sockets defined in C:\Users\ADC59E
1\AppData\Local\Temp\2\kernel-9l6jwA\connection.json...
[Positron] Control socket created (count = 1)
[Positron] Shell socket created (count = 2)
[Positron] Stdin socket created (count = 3)
[Positron] I/O socket created (count = 4)
[Positron] Heartbeat socket created (count = 5)
[Positron] Control socket connecting to tcp://127.0.0.1:42605...
[Positron] Shell socket connecting to tcp://127.0.0.1:53888...
[Positron] Stdin socket connecting to tcp://127.0.0.1:52712...
[Positron] I/O socket connecting to tcp://127.0.0.1:55002...
[Positron] Heartbeat socket connecting to tcp://127.0.0.1:56977...
[Positron] I/O socket connected to tcp://127.0.0.1:55002
[Positron] Shell socket connected to tcp://127.0.0.1:53888
[Positron] Heartbeat socket connected to tcp://127.0.0.1:56977
[Positron] Stdin socket connected to tcp://127.0.0.1:52712
[Positron] Heartbeat socket disconnected from tcp://127.0.0.1:56977
[Positron] I/O socket disconnected from tcp://127.0.0.1:55002
[Positron] Shell socket disconnected from tcp://127.0.0.1:53888
[Positron] Stdin socket disconnected from tcp://127.0.0.1:52712
[Positron] All 5 sockets disconnected; kernel exited
[R] e:\efridgeirsson\Positron\resources\app\extensions\positron-r\resources\ark\ark.exe --connection_file C:\Users\ADC59E1\AppData\Local\Temp\2\kernel-9l6jwA\connection.json --log C:\Users\ADC59E1\AppData\Local\Temp\2\kernel-9l6jwA\kernel.log --startup-file e:\efridgeirsson\Positron\resources\app\extensions\positron-r\resources\scripts\startup.R --session-mode console -- --interactive --no-restore-data

[R] 2024-08-16T09:02:45.848967Z ERROR Panic! In file 'crates\ark\src\sys\windows\interface.rs' at line 134: Failed to convert R home to UTF-8. Path 'C:\Program Files\R\R-4.2.3'. Error: [87] The parameter is incorrect.
[R]
[R] Stack backtrace:
[R] 0:
[R] 1:
[R] 2: tree_sitter_r
[R] 3:
[R] 4:
[R] 5:
[R] 6:
[R] 7:
[R] 8:
[R] 9:
[R] 10:
[R] 11: tree_sitter_r
[R] 12: BaseThreadInitThunk
[R] 13: RtlUserThreadStart.
[R]
[R] Backtrace:
[R] 0:
[R] 1:
[R] 2:
[R] 3:
[R] 4:
[R] 5:
[R] 6:
[R] 7:
[R] 8: tree_sitter_r
[R] 9:
[R] 10:
[R] 11:
[R] 12:
[R] 13:
[R] 14:
[R] 15:
[R] 16: tree_sitter_r
[R] 17: BaseThreadInitThunk
[R] 18: RtlUserThreadStart
[R]
[R] at crates\ark\src/main.rs:482
[R]
[R]
[Positron] R kernel status changed: starting => exited
[Positron] Last line of log file C:\Users\ADC59E~1\AppData\Local\Temp\2\kernel-9l6jwA\kernel.log does't name an exit code: Process exit code -1073740791

</details>

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

Start at crates/ark/src/sys/windows/interface.rs line 134 and crates/ark/src/main.rs line 482, then reproduce the R 4.2.3 startup failure on Windows using the logged command. Trace the R home conversion error and verify that the R interpreter launches successfully without the UTF-8 panic or disposed socket.

Written by the indexing model from the issue text.

Assessment

Tech stack
r, rust
Domain
backend, desktop
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.