arduino-create-agent icon indicating copy to clipboard operation
arduino-create-agent copied to clipboard

Startup fails silently if package index can't be downloaded

Open per1234 opened this issue 1 year ago • 0 comments
trafficstars

Describe the problem

On startup, Arduino Create Agent downloads a package index file from Arduino's download server.

This download might fail for a variety of reasons. If this happens, Arduino Create Agent simply fails to start without giving any indication to the user of the failure or why:

https://github.com/arduino/arduino-create-agent/blob/d4c453787561de7886d9224c97b315ea1185f89e/index/index.go#L73-L74

🐛 It is difficult for the user to determine why Arduino Create Agent won't start.

To reproduce

  1. Quit Arduino Create Agent if it is already running.
  2. Disconnect your computer from the Internet.
  3. Start Arduino Create Agent.

🐛 Arduino Create Agent fails to start. 🐛 Unless you started Arduino Create Agent from the terminal (which a normal user will never do), there is no indication of why it failed to start.

Expected behavior

Arduino Create Agent clearly communicates the failure to start and the reason to the user.

Arduino Create Agent version

d4c453787561de7886d9224c97b315ea1185f89e

Operating system

  • Windows
  • macOS

Operating system version

  • Windows 11
  • macOS Sonoma

Browser

N/A

Additional context

A basic lack of Internet access was used in the demo above for the sake of simplicity. Admittedly, since Arduino Create Agent is inherently linked to the Arduino Cloud online service, this specific scenario is probably unlikely to occur in the real world. However, there are a variety of other reasons why the download might fail such as:

  • Arduino Create Agent's access to the Internet is blocked by a firewall or proxy server
  • Transient network outage on Arduino's download server

A log file is not generated even when the crashreport key is set to true in the configuration file.


The only logs printed to the terminal are something like this, which isn't identified as an error message (as opposed to a non-critical warning):

2023/11/24 03:28:48 cannot download index: Get "https://downloads.arduino.cc/packages/package_staging_index.json": dial tcp: lookup downloads.arduino.cc: no such host

Because the Windows build of Arduino Create Agent is built as a "GUI binary", complex PowerShell acrobatics are required for Windows users to even see these logs.


Originally reported at https://forum.arduino.cc/t/create-agent-crashes-trying-to-use/1192619

Issue checklist

  • [X] I searched for previous reports in the issue tracker
  • [X] I verified the problem still occurs when using the latest version
  • [X] My report contains all necessary details

per1234 avatar Nov 24 '23 12:11 per1234