IDE hangs on startup: "panic: runtime error: slice bounds out of range"

Continuing the discussion from My arduino IDE 2.2.1. is stuck on the loading screen:

PS C:\Program Files\Arduino IDE> & ".\Arduino IDE"
PS C:\Program Files\Arduino IDE>
Arduino IDE 2.3.2
Checking for frontend application configuration customizations. Module path: C:\Program Files\Arduino IDE\resources\app\lib\backend\electron-main.js, destination 'package.json': C:\Program Files\Arduino IDE\resources\app\package.json
Setting 'theia.frontend.config.appVersion' application configuration value to: "2.3.2" (type of string)
Setting 'theia.frontend.config.cliVersion' application configuration value to: "0.35.3" (type of string)
Setting 'theia.frontend.config.buildDate' application configuration value to: "2024-02-20T10:04:35.814Z" (type of string)
Frontend application configuration after modifications: {"applicationName":"Arduino IDE","defaultTheme":{"light":"arduino-theme","dark":"arduino-theme-dark"},"defaultIconTheme":"none","electron":{"windowOptions":{}},"defaultLocale":"","validatePreferencesSchema":false,"preferences":{"window.title":"${rootName}${activeEditorShort}${appName}","files.autoSave":"afterDelay","editor.minimap.enabled":false,"editor.tabSize":2,"editor.scrollBeyondLastLine":false,"editor.quickSuggestions":{"other":false,"comments":false,"strings":false},"editor.maxTokenizationLineLength":500,"editor.bracketPairColorization.enabled":false,"breadcrumbs.enabled":false,"workbench.tree.renderIndentGuides":"none","explorer.compactFolders":false},"appVersion":"2.3.2","cliVersion":"0.35.3","buildDate":"2024-02-20T10:04:35.814Z"}
Starting backend process. PID: 7484
Using browser-only version of superagent in non-browser environment
Configuration directory URI: 'file:///c%3A/Users/Ethan/.arduinoIDE'
Configuring to accept webviews on '^.+\.webview\..+$' hostname.
2024-03-21T17:52:59.873Z root INFO Backend Object.initialize: 7.7 ms [Finished 1.229 s after backend start]
2024-03-21T17:52:59.875Z root INFO Backend Object.configure: 6.4 ms [Finished 1.229 s after backend start]
2024-03-21T17:52:59.875Z root INFO Backend s.onStart: 3.8 ms [Finished 1.229 s after backend start]
2024-03-21T17:52:59.876Z root INFO Backend s.configure: 0.5 ms [Finished 1.276 s after backend start]
2024-03-21T17:52:59.877Z root INFO Backend d.onStart: 0.4 ms [Finished 1.276 s after backend start]
2024-03-21T17:52:59.879Z root INFO Backend d.configure: 0.2 ms [Finished 1.277 s after backend start]
2024-03-21T17:52:59.881Z root INFO Backend d.initialize: 46.7 ms [Finished 1.277 s after backend start]
2024-03-21T17:52:59.881Z root INFO Backend c.onStart: 0.5 ms [Finished 1.277 s after backend start]
2024-03-21T17:52:59.882Z root INFO Backend a.configure: 2.3 ms [Finished 1.279 s after backend start]
2024-03-21T17:52:59.886Z config INFO >>> Initializing CLI configuration...
2024-03-21T17:52:59.887Z root INFO Backend c.initialize: 1.1 ms [Finished 1.280 s after backend start]
2024-03-21T17:52:59.887Z root INFO Backend R.onStart: 1.3 ms [Finished 1.281 s after backend start]
2024-03-21T17:52:59.888Z config INFO Loading CLI configuration from c:\Users\Ethan\.arduinoIDE\arduino-cli.yaml...
2024-03-21T17:52:59.889Z daemon INFO Starting daemon from C:\Program Files\Arduino IDE\resources\app\lib\backend\resources\arduino-cli.exe...
2024-03-21T17:52:59.890Z root INFO Backend a.initialize: 0.7 ms [Finished 1.283 s after backend start]
2024-03-21T17:52:59.890Z root INFO Backend w.onStart: 2.1 ms [Finished 1.285 s after backend start]
2024-03-21T17:52:59.890Z root INFO Backend r.configure: 4.0 ms [Finished 1.285 s after backend start]
2024-03-21T17:52:59.890Z discovery-log INFO start
2024-03-21T17:52:59.890Z discovery-log INFO start new deferred
2024-03-21T17:52:59.890Z root INFO Backend d.initialize: 1.2 ms [Finished 1.286 s after backend start]
2024-03-21T17:52:59.890Z root INFO Backend y.onStart: 5.2 ms [Finished 1.290 s after backend start]
2024-03-21T17:52:59.890Z root INFO Backend r.configure: 4.3 ms [Finished 1.291 s after backend start]
2024-03-21T17:52:59.891Z root INFO Backend a.onStart: 1.1 ms [Finished 1.293 s after backend start]
2024-03-21T17:52:59.891Z root INFO Backend h.configure: 1.0 ms [Finished 1.294 s after backend start]
2024-03-21T17:52:59.891Z root INFO Backend s.configure: 0.5 ms [Finished 1.294 s after backend start]
2024-03-21T17:52:59.891Z root INFO Backend l.configure: 0.2 ms [Finished 1.294 s after backend start]
2024-03-21T17:52:59.895Z root INFO Theia app listening on http://127.0.0.1:53724.
2024-03-21T17:52:59.895Z root INFO Finished starting backend application: 5.3 ms [Finished 1.299 s after backend start]
2024-03-21T17:52:59.897Z root WARN The local plugin referenced by local-dir:/c%3A/Users/Ethan/.arduinoIDE/plugins does not exist.
2024-03-21T17:52:59.897Z root WARN The local plugin referenced by local-dir:/c%3A/Users/Ethan/.arduinoIDE/extensions does not exist.
2024-03-21T17:52:59.898Z root WARN The local plugin referenced by local-dir:C:\Users\Ethan\.arduinoIDE\plugins does not exist.
2024-03-21T17:53:00.036Z config INFO Loaded CLI configuration: {"board_manager":{"additional_urls":["file:\\\\\\C:\\Users\\Ethan\\OneDrive\\Desktop\\ard"]},"build_cache":{"compilations_before_purge":10,"ttl":"720h0m0s"},"daemon":{"port":"50051"},"directories":{"builtin":{"libraries":"C:\\Users\\Ethan\\AppData\\Local\\Arduino15\\libraries"},"data":"c:\\Users\\Ethan\\AppData\\Local\\Arduino15","downloads":"C:\\Users\\Ethan\\AppData\\Local\\Arduino15\\staging","user":"c:\\Users\\Ethan\\OneDrive\\Documents\\Arduino"},"library":{"enable_unsafe_install":false},"locale":"en","logging":{"file":"","format":"text","level":"info"},"metrics":{"addr":":9090","enabled":true},"output":{"no_color":false},"sketch":{"always_export_binaries":false},"updater":{"enable_notification":true}}
2024-03-21T17:53:00.036Z config INFO 'directories.data' and 'directories.user' are set in the CLI configuration model.
2024-03-21T17:53:00.036Z config INFO Loaded the CLI configuration.
2024-03-21T17:53:00.049Z config INFO Mapped the CLI configuration: {"dataDirUri":"file:///c%3A/Users/Ethan/AppData/Local/Arduino15","sketchDirUri":"file:///c%3A/Users/Ethan/OneDrive/Documents/Arduino","additionalUrls":["file:\\\\\\C:\\Users\\Ethan\\OneDrive\\Desktop\\ard"],"network":"none","locale":"en"}
2024-03-21T17:53:00.049Z config INFO Validating the CLI configuration...
2024-03-21T17:53:00.049Z config INFO The CLI config is valid.
2024-03-21T17:53:00.049Z config INFO <<< Initialized the CLI configuration.
2024-03-21T17:53:00.331Z root INFO Resolve plugins list: 443.3 ms [Finished 1.734 s after backend start]
2024-03-21T17:53:00.743Z daemon INFO time="2024-03-21T17:53:00Z" level=info msg="Using config file: c:\\Users\\Ethan\\.arduinoIDE\\arduino-cli.yaml"
time="2024-03-21T17:53:00Z" level=info msg="arduino-cli.exe version 0.35.3"
time="2024-03-21T17:53:00Z" level=info msg="Executing `arduino-cli daemon`"
2024-03-21T17:53:00.756Z daemon INFO Daemon is now listening on 127.0.0.1:53725
{"IP":"127.0.0.1","Port":"53725"}
2024-03-21T17:53:00.756Z daemon INFO Daemon is running.
2024-03-21T17:53:00.788Z daemon INFO panic: runtime error: slice bounds out of range [1:0]

goroutine 34 [running]:
2024-03-21T17:53:00.788Z daemon INFO github.com/arduino/arduino-cli/arduino/utils.URLParse({0xc00002f740?, 0xb0795a?})
        /home/build/arduino/utils/url.go:34 +0x99
github.com/arduino/arduino-cli/commands.Init(0xc0000ce0f0, 0x0?)
        /home/build/commands/instances.go:146 +0x647
github.com/arduino/arduino-cli/commands/daemon.(*ArduinoCoreServerImpl).Init(0xc0000d0000?, 0xa69640?, {0xe29050?, 0xc00009e230})
        /home/build/commands/daemon/daemon.go:154 +0xc5
github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1._ArduinoCoreService_Init_Handler({0xad57a0?, 0xc00038e3c0}, {0xe278e8, 0xc0000d0000})
        /home/build/rpc/cc/arduino/cli/commands/v1/commands_grpc.pb.go:1311 +0xd3
google.golang.org/grpc.(*Server).processStreamingRPC(0xc00023a1e0, {0xe24dd8, 0xc00040e150}, {0xe2a040, 0xc0003a64e0}, 0xc000426000, 0xc000388b70, 0x1508fc0, 0x0)
        /go/pkg/mod/google.golang.org/grpc@v1.59.0/server.go:1637 +0x1348
google.golang.org/grpc.(*Server).handleStream(0xc00023a1e0, {0xe2a040, 0xc0003a64e0}, 0xc000426000)
        /go/pkg/mod/google.golang.org/grpc@v1.59.0/server.go:1741 +0xbfb
google.golang.org/grpc.(*Server).serveStreams.func1.1()
        /go/pkg/mod/google.golang.org/grpc@v1.59.0/server.go:986 +0x86
created by google.golang.org/grpc.(*Server).serveStreams.func1 in goroutine 10
        /go/pkg/mod/google.golang.org/grpc@v1.59.0/server.go:997 +0x145
2024-03-21T17:53:00.798Z root ERROR Error occurred while initializing the core gRPC client provider Error: 14 UNAVAILABLE: read ECONNRESET
    at t.callErrorFromStatus (C:\Program Files\Arduino IDE\resources\app\lib\backend\main.js:2:763461)
    at Object.onReceiveStatus (C:\Program Files\Arduino IDE\resources\app\lib\backend\main.js:2:791078)
    at Object.onReceiveStatus (C:\Program Files\Arduino IDE\resources\app\lib\backend\main.js:2:784102)
    at C:\Program Files\Arduino IDE\resources\app\lib\backend\main.js:2:870224
    at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
for call at
    at s.makeServerStreamRequest (C:\Program Files\Arduino IDE\resources\app\lib\backend\main.js:2:790845)
    at s.init (C:\Program Files\Arduino IDE\resources\app\lib\backend\main.js:2:855121)
    at C:\Program Files\Arduino IDE\resources\app\lib\backend\main.js:2:622262
    at new Promise (<anonymous>)
    at E.initInstance (C:\Program Files\Arduino IDE\resources\app\lib\backend\main.js:2:622228)
    at E.initInstanceWithFallback (C:\Program Files\Arduino IDE\resources\app\lib\backend\main.js:2:621035)
    at E.create (C:\Program Files\Arduino IDE\resources\app\lib\backend\main.js:2:620940)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2024-03-21T17:53:00.800Z root ERROR Uncaught Exception:  Error: 14 UNAVAILABLE: read ECONNRESET
2024-03-21T17:53:00.800Z root ERROR Error: 14 UNAVAILABLE: read ECONNRESET
    at t.callErrorFromStatus (C:\Program Files\Arduino IDE\resources\app\lib\backend\main.js:2:763461)
    at Object.onReceiveStatus (C:\Program Files\Arduino IDE\resources\app\lib\backend\main.js:2:791078)
    at Object.onReceiveStatus (C:\Program Files\Arduino IDE\resources\app\lib\backend\main.js:2:784102)
    at C:\Program Files\Arduino IDE\resources\app\lib\backend\main.js:2:870224
    at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
for call at
    at s.makeServerStreamRequest (C:\Program Files\Arduino IDE\resources\app\lib\backend\main.js:2:790845)
    at s.init (C:\Program Files\Arduino IDE\resources\app\lib\backend\main.js:2:855121)
    at C:\Program Files\Arduino IDE\resources\app\lib\backend\main.js:2:622262
    at new Promise (<anonymous>)
    at E.initInstance (C:\Program Files\Arduino IDE\resources\app\lib\backend\main.js:2:622228)
    at E.initInstanceWithFallback (C:\Program Files\Arduino IDE\resources\app\lib\backend\main.js:2:621035)
    at E.create (C:\Program Files\Arduino IDE\resources\app\lib\backend\main.js:2:620940)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2024-03-21T17:53:00.803Z daemon INFO Daemon exited with exit code: 2.
Opening channel for service path '/services/electron-window'.
Opening channel for service path '/services/ide-updater'.
2024-03-21T17:53:06.179Z root WARN Frontend a.configure took longer than the expected maximum 100 milliseconds: 1115.4 ms [Finished 5.896 s after frontend start]
2024-03-21T17:53:06.179Z root WARN A command editor.action.toggleStickyScroll is already registered.
2024-03-21T17:53:07.133Z root WARN Frontend D.onStart took longer than the expected maximum 100 milliseconds: 629.8 ms [Finished 6.860 s after frontend start]
2024-03-21T17:53:08.766Z root INFO Deploy plugins list: 443.3 ms [Finished 10.170 s after backend start]

Hi @imethan007ahahahah. It appears you put something like file:// into the IDE's Additional Boards Manager URLs preference.

Unfortunately it won't be possible to remove the bad data from the preferences using the IDE's Preference GUI since the IDE won't start up now, so it is necessary to remove it directly from the configuration file where this preference is stored. I think it will be most simple to delete the configuration file. This will force Arduino IDE to generate a valid configuration file on the next startup, using the default configuration values.

I'll provide instructions you can follow to do that:

  1. Close the Arduino IDE window if it is running.
  2. Delete the file at the following path:
    c:\Users\Ethan\.arduinoIDE\arduino-cli.yaml
    
    :warning: Please be careful when deleting things from your computer. When in doubt, back up!

Now start Arduino IDE again. Hopefully it will start up and work as expected.

Note that the IDE preferences that were stored in this file will have been reset to the default values. If you had customized either the "Sketchbook location" or "Additional Boards Manager URLs" preferences before, you'll need to select File > Preferences... from the Arduino IDE menus and then set those preferences once again after performing the instructions I provided above.


Please let me know if you have any questions or problems while following those instructions.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.