2.0.1 gets confused when making new project

I copied a project I had to a new folder, renamed the folder and also the .ino file within (so I have a working project to roll back to if needed).
I opened the .ino file with Windows explorer, and 2.0.1 opened it up. It had no board select, despite the Teensy 4.1 being the last one I used. No problem, I went to Tools and selected it.
The board is, at the moment, unplugged. I selected sketch->verify/compile and this is what I got:

Note I have the proper board selected, I think it should compile it for me regardless of the port selection status.

  • Wes

Hi @weshowe. I'm going to ask you to post some additional information that might help us to identify the problem.

Please do this:

  1. Start Windows "File Explorer".
  2. Open the Arduino IDE installation folder.
    (usually C:\Program Files\Arduino IDE or C:\Users\<user name>\AppData\Local\Programs\Arduino IDE).
  3. In the folder listing of the Arduino IDE installation folder, hold the Shift key while clicking the right hand button on the mouse.
  4. From the context menu, click "Open PowerShell window here".
    PowerShell will now open with the current directory set to the Arduino IDE installation folder.
  5. Type the following command:
    & ".\Arduino IDE"
    
  6. Press the Enter key.
    Debug output should now be printed to the PowerShell window as the Arduino IDE starts (or fails to start).
  7. Do whatever actions are needed to produce the "No connection established" error.
  8. Switch back to the PowerShell window.
  9. Right click on the title bar of the PowerShell window.
    This will open a context menu.
  10. Select Edit > Select All from the context menu.
    This will select all the text in the PowerShell window.
  11. Press Ctrl+C.
    This will copy the contents of the PowerShell window to the clipboard.
  12. Open a forum reply here by clicking the Reply button.
  13. Click the </> icon on the post composer toolbar.
    This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
    Code block
  14. Press Ctrl+V.
    This will paste the output into the code block.
  15. Move the cursor outside of the code block markup before you add any additional text to your reply.
  16. Click the Reply button to post the output.

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

In other words, the sketches can't be verified with no board connected. This is why I don't use IDE 2.0 yet :slightly_smiling_face:.

This is incorrect. You can compile for any board regardless of whether it is connected or even whether you own the hardware. I do this constantly because I have to provide support for users with a very wide array of boards.

We should be careful to verify statements before publishing them here on the forum. The posts here serve as references for many people over the years to come, so misinformation can be very harmful.

I'm sorry I won't be able to do any powershell data gathering.
What finally worked was only after I connected a Teensy 4.1 board, and then open the Serial Monitor, which now automagically allowed the "Port" menu item to appear from the bowels of wherever it resides, prepopulated with a checkmark for Com4 (the correct one for my machine).

After that, verify/compile and upload work as expected. But my attempts prior to plugging the Teensy 4.1 in physically (including close+restart) were for naught.
It looks to me like when the Serial Monitor connects to the board, it cures the Cancer in the core.

It is obvious to me that when I get something set up in the manner that makes IDE 2.0.1 happy, it compiles and uploads exacting code that, as best I can discern is 100% properly compiled and works like a champ.

It's just some growing issues that need fixed.

  • Wes

Unfortunately it is very difficult to fix issues when the developers can't reproduce them. In this case, we are dependent on whatever information we can gather from the affected users.

There have been a couple of other reports of "No connection established" errors. This is a very generic error that might have any number of causes, so there is no guarantee that all the reports have the same cause, but I am doing my best to investigate all of them:

Why didn't you just save the project as a different name within the IDE.
Then go back to the original and continue?

I just keep updating my code name as I go, code_1, code_2, code_3 etc.
That way I have complete codes of my previous versions.

Tom.. :smiley: :+1: :coffee: :australia:

I hit the no connections error this afternoon on macOS with 2.0.1 when trying to perform a Verify/Compile. It was the first time I hit it and then I hit it again an hour or so later but can't come up with a way to repro it again. The one thing that I always had on the go when it happened was I had multiple sketches open. They were different sketches with one targeting the Uno and the others targeting the Portenta H7.

1 Like

At one point in time, 2.0 RC-something sometimes refused to finish a Save-As. So I just do my own, being careful to ensure that the folder name and the .ino filename match. It is functionally equivalent to downloading and unzipping some code. The old folder holds my known, working project, so if I Bozo the new one up, I can start over.

  • Wes

Steps to reproduce:

  • Fresh install of Arduino IDE 2.0.1
  • Create new project
  • Select Arduino Nano board
  • Ctrl+R

Compilation Error: No Connection Established

It is checking for COM Port on Verify/Compile.

The accusatory tone of the developers in responding to this issue is inappropriate. I was able to reproduce this on multiple machines in 30 seconds.

1 Like

@rbtsev_riley I just tried your repro steps except that I used the install of Arduino IDE 2.0.1 that I already had installed and got the connection error so I was able to verify your repro steps.

I have attached the output logged to the Terminal window from which the IDE was launched when this error was encountered. Hopefully it can help to narrow down the cause of this issue.
arduino_ide.log (57.2 KB)

1 Like

Hi @rbtsev_riley thanks for your report and the steps to reproduce!

Which operating system are you using (e.g., "Windows")?

I ask because I would like to request you to provide some additional information and I want to give you the appropriate instructions for your operating system.

I feel the same about this comment. Let's skip the drama and focus on fixing the bug.

I'm sorry to hear that.

As I mentioned, the development team and myself compile many sketches every day and have not been able to reproduce this (even following the steps you helpfully provided exactly). So this bug only occurs under some specific unknown conditions. It clearly does not affect all users universally because we would be absolutely swamped with reports. One of the developers experienced it once under very specific conditions, but afterward was no longer able to reproduce it.

With the assistance of the community, I'm confident we will be able to determine the required conditions, after which the work to fix the bug can begin.

When I run @rbtsev_riley 's steps on my macOS machine I get build failures as well but what I noticed is that as soon as I pick the Nano target, I see the following errors spewed to the Terminal:

daemon INFO panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x42ffc5d]

goroutine 379 [running]:
github.com/arduino/go-properties-orderedmap.(*Map).Merge(0x0, {0xc006a1f658, 0x1, 0x0})
	/go/pkg/mod/github.com/arduino/go-properties-orderedmap@v1.6.0/properties.go:443 +0x3d
github.com/arduino/go-properties-orderedmap.(*Map).Clone(...)
	/go/pkg/mod/github.com/arduino/go-properties-orderedmap@v1.6.0/properties.go:477
github.com/arduino/arduino-cli/arduino/cores.(*Board).GetBuildProperties(0xc0005adbc0, 0xc0031b2c90)
	/home/build/arduino/cores/board.go:119 +0xd5
github.com/arduino/arduino-cli/arduino/cores/packagemanager.(*Explorer).ResolveFQBN(0xc004c66780, 0xc0035b8580)
	/home/build/arduino/cores/packagemanager/package_manager.go:291 +0x105
github.com/arduino/arduino-cli/commands/lib.LibraryList({0x400cd45, 0x49b9100}, 0xc003bdc480)
	/home/build/commands/lib/list.go:57 +0x24a
github.com/arduino/arduino-cli/commands/daemon.(*ArduinoCoreServerImpl).LibraryList(0x4983940, {0x4c5e870, 0xc0031b2c00}, 0xc001ee21b0)
	/home/build/commands/daemon/daemon.go:467 +0x2c
github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1._ArduinoCoreService_LibraryList_Handler({0x49cdd60, 0xc0002ced60}, {0x4c5e870, 0xc0031b2c00}, 0xc003bdc420, 0x0)
	/home/build/rpc/cc/arduino/cli/commands/v1/commands_grpc.pb.go:2051 +0x173
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0002548c0, {0x4c70c18, 0xc000430000}, 0xc00637ec60, 0xc0003ded80, 0x52b27d8, 0x0)
	/go/pkg/mod/google.golang.org/grpc@v1.38.0/server.go:1286 +0xc8f
google.golang.org/grpc.(*Server).handleStream(0xc0002548c0, {0x4c70c18, 0xc000430000}, 0xc00637ec60, 0x0)
	/go/pkg/mod/google.golang.org/grpc@v1.38.0/server.go:1609 +0xa2a
google.golang.org/grpc.(*Server).serveStreams.func1.2()
	/go/pkg/mod/google.golang.org/grpc@v1.38.0/server.go:934 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
	/go/pkg/mod/google.golang.org/grpc@v1.38.0/server.go:932 +0x294

discovery-log INFO error received
discovery-log ERROR Unexpected error occurred during the boards discovery.
discovery-log INFO received end
root ERROR Request list failed with error: 14 UNAVAILABLE: read ECONNRESET
root ERROR Request getBoardDetails failed with error: 14 UNAVAILABLE: read ECONNRESET
root ERROR Request search failed with error: 14 UNAVAILABLE: read ECONNRESET
root ERROR Request getInstalledBoards failed with error: 14 UNAVAILABLE: read ECONNRESET
daemon INFO Daemon exited with exit code: 2.
root ERROR Request getBoardDetails failed with error: 14 UNAVAILABLE: No connection established
root ERROR Request getBoardDetails failed with error: 14 UNAVAILABLE: No connection established
root INFO Failed to start language server for arduino:avr:nano
root ERROR Request getBoardDetails failed with error: 14 UNAVAILABLE: No connection established

It looks like it is crashing in some Go code. Is it a network issue? That might explain why not everyone hits it the same way?

Thanks! That is very useful information. The reports have been correlating the problem with compilation, but this indicates the compilation failure is only a symptom of the problem that occurred prior to the initiation of compilation, while the IDE was doing some processing operation following the selection of the board.

This is from Arduino CLI, which provides all the non-GUI functionality for Arduino IDE 2.x under the hood.

In the other reports where I have been successful in obtaining logs from the users, they also showed a panic either identical or similar to the one shown in your logs:

Possibly. The "No connection established" error is referring to the TCP/IP connection between Arduino IDE 2.x and Arduino CLI.

However, this "No connection established" error seems to me to be only a symptom of the panic/crash you noted. For example, I can produce the same error during compilation by manually killing the arduino-cli process on my machine before triggering a compilation operation in the IDE.

1 Like

The "not connected" error with the board plugged in happens for me every so often when I use the resetFunc() I have temporarily tied to an unused switch.
But I have only tested it with 2.0.1 on a Teensy 4.1. I never reported it because it is intermittent and I can unplug and replug the usb easy enough and get what I am after, a restart for testing my startup code.

I mention this because the root cause could be part of the same code issue.
Or it may be something else entirely.

  • Wes

Ahh, I guess if the CLI end crashed, it would kill the socket so that would be why the IDE gets the ECONNRESET error. I guess now the question is why the CLI end crashes.

Do you know if there is a way for me to launch this server under GDB or LLDB (on macOS) so that it can be debugged when this crash occurs? It would be nice if I could generate a full crash dump when this happens and send it to you.

Win7, Win10, Win11. Sorry. I didn't even see that we released cross platform binaries yet, my bad.

One was upgraded from 1.8.x, the others were fresh installs.

Further update: installing new board files caused the issue to go away; for generic boards like "arduino nano", the issue persists indefinitely.

Thanks! Here are the instructions:

  1. Start Windows "File Explorer".
  2. Open the Arduino IDE installation folder.
    (usually C:\Program Files\Arduino IDE or C:\Users\<user name>\AppData\Local\Programs\Arduino IDE).
  3. In the folder listing of the Arduino IDE installation folder, hold the Shift key while clicking the right hand button on the mouse.
  4. From the context menu, click "Open PowerShell window here".
    PowerShell will now open with the current directory set to the Arduino IDE installation folder.
  5. Type the following command:
    & ".\Arduino IDE"
    
  6. Press the Enter key.
    Debug output should now be printed to the PowerShell window as the Arduino IDE starts (or fails to start).
  7. Take whatever actions are required to produce the error in Arduino IDE.
  8. Switch back to the PowerShell window.
  9. Right click on the title bar of the PowerShell window.
    This will open a context menu.
  10. Select Edit > Select All from the context menu.
    This will select all the text in the PowerShell window.
  11. Press Ctrl+C.
    This will copy the contents of the PowerShell window to the clipboard.
  12. Open a forum reply here by clicking the Reply button.
  13. Click the </> icon on the post composer toolbar.
    This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
  14. Press Ctrl+V.
    This will paste the output into the code block.
  15. Move the cursor outside of the code block markup before you add any additional text to your reply.
  16. Click the Reply button to post the output.

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

I had to get back to production, so I don't have the 2.0.1 build environment around anymore. When I've got a bit of time, I'll fire it up again and reproduce it for you with debug output.

Though I'll be honest, you might want to suggest they pipe that to a file rather than copypaste a powershell window. Copy/Paste from windows terminals isn't the most reliable thing.