Skip to content

Error message not displayed when Boards Manager installation fails with "UNKNOWN" status code #2269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
3 tasks done
per1234 opened this issue Oct 28, 2023 · 2 comments
Open
3 tasks done
Assignees
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@per1234
Copy link
Contributor

per1234 commented Oct 28, 2023

Describe the problem

When a Boards Manager installation fails due to a platform or tool archive file download failing with an "UNKNOWN" status code, Arduino IDE does not display the error message provided by Arduino CLI.

🐛 The lack of this important information will make it difficult to troubleshoot and support the failure.

To reproduce

  1. Create a file named package_foo_index.json with the following content:
    {
      "packages": [
        {
          "name": "foo",
          "maintainer": "nobody",
          "websiteURL": "https://github.com/arduino/arduino-ide/issues/2269",
          "email": "[email protected]",
          "platforms": [
            {
              "name": "arduino/arduino-ide#2269 demo",
              "architecture": "bar",
              "version": "0.0.0",
              "category": "Contributed",
              "help": {
                "online": "http://example.com/"
              },
              "url": "https://expired.badssl.com/",
              "archiveFileName": "baz",
              "checksum": "SHA-256:203d2717c7004209e38a498f35761c23f47f4447640ba130f5fe48f753ddd581",
              "size": "123",
              "boards": [],
              "toolsDependencies": []
            }
          ],
          "tools": []
        }
      ]
    }
  2. Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
    The "Preferences" dialog will open.
  3. Enter a URL with file scheme pointing to the path of the package_foo_index.json on your computer into the "Additional Boards Manager URLs" field in the "Preferences" dialog.
    For example, if the file was at e:\stuff\package_foo_index.json, you would enter the following URL:
    file:///e:/stuff/package_foo_index.json
    
    ❗ If there are already Boards Manager URLs in the field, separate them with commas.
  4. Click the "OK" button.
  5. You will now see a "Downloading index: ..." notification at the bottom right corner of the IDE window. Wait for that notification to close.
  6. Select Tools > Board > Boards Manager from the Arduino IDE menus to open the "Boards Manager" view in the left side panel.
  7. Scroll down through the list of boards platforms until you see the "arduino/arduino-ide#2269 demo" entry.
  8. Click the "INSTALL" button at the bottom of the entry.

🐛 Arduino IDE does not display any information about the installation failure:

Notification:

Failed to install platform: 'arduino/arduino-ide#2269 demo:0.0.0'. 2 UNKNOWN:

Output view:

Downloading packages
foo:[email protected]
Failed to install platform: 'foo:bar:0.0.0'.
Error: 2 UNKNOWN: 

Expected behavior

Arduino IDE displays useful error message content when a failure occurs.

In the demo above, the expected behavior is to print the error message:

Notification:

Failed to install platform: 'arduino/arduino-ide#2269 demo:0.0.0'. 2 UNKNOWN: Get "https://expired.badssl.com/": tls: failed to verify certificate: x509: certificate has expired or is not yet valid:

Output view:

Downloading packages
foo:[email protected]
Failed to install platform: 'foo:bar:0.0.0'.
Error: 2 UNKNOWN: Get "https://expired.badssl.com/": tls: failed to verify certificate: x509: certificate has expired or is not yet valid:

Arduino IDE version

Original report

69b7365

Last verified with

aa9b10d

Operating system

Windows

Operating system version

11

Additional context

I bisected the regression to #2199 (fault does not occur when using the build from the previous commit, 7f660d7).


When the arduino.cli.daemon.debug setting is enabled, you can see from the logs that Arduino IDE does receive the message from Arduino CLI:

2023-10-28 05:47:03 2023-10-28T12:47:03.762Z daemon INFO 59 CALLED: /cc.arduino.cli.commands.v1.ArduinoCoreService/PlatformInstall STREAM_RESP
2023-10-28 05:47:03 2023-10-28T12:47:03.763Z daemon INFO 59 |  REQ:  {
59 |    "instance": {
59 |      "id": 1
59 |    },
59 |    "platform_package": "foo",
59 |    "architecture": "bar",
59 |    "version": "0.0.0"
59 |  }
2023-10-28 05:47:03 2023-10-28T12:47:03.764Z daemon INFO 59 |  RESP: {
59 |    "task_progress": {
59 |      "name": "Downloading packages"
59 |    }
59 |  }
time="2023-10-28T05:47:03-07:00" level=info msg="Starting download" url="https://expired.badssl.com/"
59 |  RESP: {
59 |    "progress": {
59 |      "Message": {
59 |        "Start": {
59 |          "url": "https://expired.badssl.com/",
59 |          "label": "foo:[email protected]"
59 |        }
59 |      }
59 |    }
59 |  }
2023-10-28 05:47:03 2023-10-28T12:47:03.978Z daemon INFO 59 |  RESP: {
59 |    "progress": {
59 |      "Message": {
59 |        "End": {
59 |          "message": "Get \"https://expired.badssl.com/\": tls: failed to verify certificate: x509: certificate has expired or is not yet valid: "
59 |        }
59 |      }
59 |    }
59 |  }
59 |  ERROR:  Get "https://expired.badssl.com/": tls: failed to verify certificate: x509: certificate has expired or is not yet valid: 
59 STREAM CLOSED
2023-10-28 05:47:03 2023-10-28T12:47:03.979Z discovery-log INFO start
2023-10-28 05:47:03 2023-10-28T12:47:03.979Z discovery-log INFO start new deferred
2023-10-28 05:47:03 2023-10-28T12:47:03.979Z root ERROR Request install failed with error: 2 UNKNOWN:  Error: 2 UNKNOWN: 
    at t.callErrorFromStatus (C:\arduino-tools\231-69b7365\resources\app\lib\backend\main.js:2:724760)
    at Object.onReceiveStatus (C:\arduino-tools\231-69b7365\resources\app\lib\backend\main.js:2:752377)
    at Object.onReceiveStatus (C:\arduino-tools\231-69b7365\resources\app\lib\backend\main.js:2:745401)
    at C:\arduino-tools\231-69b7365\resources\app\lib\backend\main.js:2:831523
    at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
for call at
    at a.makeServerStreamRequest (C:\arduino-tools\231-69b7365\resources\app\lib\backend\main.js:2:752144)
    at a.platformInstall (C:\arduino-tools\231-69b7365\resources\app\lib\backend\main.js:2:816420)
    at b.install (C:\arduino-tools\231-69b7365\resources\app\lib\backend\main.js:2:84350)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async u.onRequest (C:\arduino-tools\231-69b7365\resources\app\lib\backend\main.js:2:1068332)
    at async c.handleRequest (C:\arduino-tools\231-69b7365\resources\app\lib\backend\main.js:2:1059227)

I used the relatively rare conditions of downloading a platform archive file from a server with an expired SSL certificate for the demo since that was how I happened to encounter the fault, and is easy to reproduce. However, I suspect that the fault might also occur under other conditions where the information from the error message will be even more important.

There are regular reports on Arduino Forum of mysterious failures that have an "UNKNOWN" status code:

https://forum.arduino.cc/search?expanded=true&q=%22Error%3A%202%20UNKNOWN%22

These would be even more difficult to support without this information.

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details
@per1234 per1234 added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Oct 28, 2023
@giacomocusinato
Copy link
Collaborator

Tested both on MacOS 14.3

  • Locally at aa9b10d
  • Release version 2.3.2

The error shows correctly as a notification and in the output view. Perhaps might be a Windows problem?

@per1234
Copy link
Contributor Author

per1234 commented Feb 24, 2024

Perhaps might be a Windows problem?

I confirm.

I am still able to reproduce the fault using the build from aa9b10d on two separate Windows machines by following the instructions from the issue report, but I have now checked on my macOS and Linux machines and the error message is shown as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

2 participants