プロキシ環境下で Arduino IDE 2.0 が起動しないときの対処 (Windows, Arduino IDE 2.3.4)

# 1: はじめに

記事の後ろには、試行錯誤中のログも掲載しています。

## 1-1: 前提条件
* Windows 10 Pro
    * Linux や macOS でも同様に対処できる可能性はあります
* **Arduino IDE 2.0** (動作確認は 2.3.4)
    * vscode がベースとなった新しいバージョン
    * zip 版も Installer 版も同様と思われる
* **プロキシ経由でのネットワーク通信しか許可されていないネットワーク環境**
    * 企業や学校ネットワークにおいて、フィルタリングが入っている場合が該当します
    * 最低限、プロキシを経由しても https://www.arduino.cc/ へアクセスできる必要があります

プロキシ環境下で Arduino IDE を起動させようとしたとき、次の画像の状態で先に進まなくなった場合は、本資料の内容が役立つかもしれません。

残念ながら、Windows 設定アプリのプロキシ情報は使われないようです。

![02.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/125577/4a0d1236-8776-d018-232a-af79a3ae14ae.png)

## 1-2: 参考資料

* [Arduino IDE 2.0.0 (Windows Proxy環境)で起動画面でグルグル](https://zenn.dev/ignorant/scraps/4edf73e9399b57)
* [Arduino 2.3.0 can't open the app on WIN11](https://forum.arduino.cc/t/arduino-2-3-0-cant-open-the-app-on-win11/1221812/2)
* [Arduino 2.0 won't start](https://forum.arduino.cc/t/arduino-2-0-wont-start/1038193/4)

# 2: 手順

## 2-1: 忙しい方向け

設定ファイル `arduino-cli.yaml` と環境変数 (HTTP_PROXY, HTTPS_PROXY, NO_PROXY) の両方にプロキシ情報を設定する必要があり、どちらか片方だけでは正常に起動しませんでした。
ただ、設定ファイルへの設定のみで起動することもあり、詳しいところはよくわかっていません。

次の場所に格納された設定ファイルを開きます。（存在しない場合は、失敗してもよいので1回 Arduino を起動する）

```:設定ファイルの場所
# Windows
%USERPROFILE%\.arduinoIDE\arduino-cli.yaml

# Windows (ユーザ名が user のとき）
C:\Users\user\.arduinoIDE\arduino-cli.yaml
```

設定ファイルをエディタで開き、 `network:` から始まるプロキシ情報を追加します。
```yaml: arduino-cli.yaml
board_manager:  # 既存の設定
    additional_urls: []
network:  # 追加
    proxy: http://<proxy>:<port>  # 認証がないとき
    proxy: http://<username>:<password>@<proxy>:<port>  # 認証があるとき
```

最後に `Arduino IDE.exe` が存在するディレクトリで、環境変数を指定して実行すると、正常に起動するはずです。

```batch:コマンドプロンプト
cd "%USERPROFILE%\AppData\Local\Programs\Arduino IDE\"
set HTTP_PROXY=http://<proxy>:<port>
set HTTPS_PROXY=http://<proxy>:<port>
set NO_PROXY=127.0.0.1,localhost
".\Arduino IDE.exe"
```

```powershell:PowerShell
cd $Env:USERPROFILE"\AppData\Local\Programs\Arduino IDE\"
$env:HTTP_PROXY="http://<proxy>:<port>"
$env:HTTPS_PROXY="http://<proxy>:<port>"
$env:NO_PROXY="127.0.0.1,localhost"
& ".\Arduino IDE.exe"
```

:::note warn
環境変数は `HTTP_PROXY` や `HTTPS_PROXY` だけではなく `NO_PROXY` も必要です。
:::

## 2-2: ある程度丁寧な説明
### 2-2-1: 設定ファイル arduino-cli.yaml
まず、ユーザごとに作成されている設定ファイルにプロキシ情報を追加します。

```:設定ファイルの場所 (デフォルトのままユーザインストールしたとき)
# Windows
%USERPROFILE%\.arduinoIDE\arduino-cli.yaml

# Windows (ユーザ名が user の方の例）
C:\Users\user\.arduinoIDE\arduino-cli.yaml
```

設定ファイルを Visual Studio Code などのエディタで開き、 `network:` から始まるプロキシ情報を追加します。
```yaml: arduino-cli.yaml
board_manager:  # 既存の設定
    additional_urls: []
network:  # 追加
    proxy: http://<proxy>:<port>  # 認証がないとき
    proxy: http://<username>:<password>@<proxy>:<port>  # 認証があるとき
```

プロキシサーバへのアドレスが `proxy.example.com` で、ポート番号が `8080` 、認証がないときは、次のように指定することになります。
```yaml: 追加例 (認証なし)
network:
    proxy: http://proxy.example.com:8080
```

### 2-2-2: 環境変数を指定しつつ起動する

まずは、Arduino IDE がインストールされている場所をエクスプローラで開きます。

```:インストール場所
# Windows
%USERPROFILE%\AppData\Local\Programs\Arduino IDE\

# Windows (ユーザ名が user の方の例）
C:\Users\user\AppData\Local\Programs\Arduino IDE\
```

:::note info
エクスプローラのアドレスバーに `%USERPROFILE%\AppData\Local\Programs\Arduino IDE\` をコピペすると、一発で開けます。
:::

:::note warn
Cドライブからフォルダを辿って開くときは、 `AppData` フォルダが隠しフォルダになっているため、隠しフォルダを表示させてから探してください。
:::

開いたフォルダの中に `Arduino IDE.exe` が存在することを確認してください。

![01.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/125577/f6576447-6164-724f-76c5-7d97a837c6f7.png)

次に、フォルダの中に次のような **バッチファイル** を作成します。
```batch:ArduinoProxy.bat
set HTTP_PROXY=http://<proxy>:<port>
set HTTPS_PROXY=http://<proxy>:<port>
set NO_PROXY=127.0.0.1,localhost
".\Arduino IDE.exe"
```

:::note info
バッチファイルの作成方法

メモ帳などでテキストファイルを作成し、上記の数行を記述します。
ファイル名は `ArduinoProxy.bat` のように、拡張子 .bat で保存します。

もちろん、 `<proxy>` や `<port>` は実際の値に書き換えます。
:::

最後にダブルクリックすると起動するはずです。
今回紹介した方法は、コマンドプロンプト（黒い画面）も同時に表示されます。

# 3: 試行錯誤

## 3-1: ログの表示
Arduino IDE は、アイコンをダブルクリックするなど GUI で起動するとログが表示されません。
コマンドプロンプトや PowerShell で `Arduino IDE.exe` を直接起動することで、ログを表示できます。

`Arduino IDE.exe` の場所について
```bat:Arduino IDE 本体 (デフォルトのままユーザインストールしたとき)
Rem Windows
%USERPROFILE%\AppData\Local\Programs\Arduino IDE\

Rem Windows (ユーザ名が user だったときの例）
C:\Users\user\AppData\Local\Programs\Arduino IDE\
```

コマンドプロンプトで実行するとき
```bat: Arduino IDE コマンド実行
cd "%USERPROFILE%\AppData\Local\Programs\Arduino IDE\"
".\Arduino IDE.exe"
Rem 以降、ログが表示しながら起動する
```

## 3-2: プロキシ設定なしで起動してみる（失敗）

最初は、プロキシ設定なしで起動してみました。
Windows 側のプロキシ設定はされており、ウェブサイトの閲覧などは問題ない状況です。

私の環境では、次のようなエラーが出ていました。
プロキシを経由せず `104.18.10.21:443` へ直接アクセスしようとしていて、タイムアウトになっています。
（ちなみに、ファイアウォールで遮断されていることをログで確認しました）

```
2025-02-06T11:47:48.419Z root ERROR Detected an error response during the gRPC core client initialization: code: 3, message: Error downloading index 'https://downloads.arduino.cc/libraries/library_index.tar.bz2': Get "https://downloads.arduino.cc/libraries/library_index.tar.bz2": dial tcp 104.18.10.21:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
```

<details><summary>実行結果をすべて読む</summary>

```
Arduino IDE 2.3.4
Checking for frontend application configuration customizations. Module path: C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\lib\backend\electron-main.js, destination 'package.json': C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\package.json
Setting 'theia.frontend.config.appVersion' application configuration value to: "2.3.4" (type of string)
Setting 'theia.frontend.config.cliVersion' application configuration value to: "1.1.1" (type of string)
Setting 'theia.frontend.config.buildDate' application configuration value to: "2024-12-03T10:03:03.490Z" (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.4","cliVersion":"1.1.1","buildDate":"2024-12-03T10:03:03.490Z"}
Starting backend process. PID: 8276
Using browser-only version of superagent in non-browser environment
Configuration directory URI: 'file:///c%3A/Users/user00/.arduinoIDE'
Configuring to accept webviews on '^.+\.webview\..+$' hostname.
2025-02-06T11:47:05.836Z root INFO Backend Object.initialize: 4.0 ms [Finished 0.525 s after backend start]
2025-02-06T11:47:05.840Z root INFO Backend Object.configure: 3.4 ms [Finished 0.525 s after backend start]
2025-02-06T11:47:05.840Z root INFO Backend s.onStart: 1.9 ms [Finished 0.525 s after backend start]
2025-02-06T11:47:05.840Z root INFO Backend s.configure: 0.3 ms [Finished 0.546 s after backend start]
2025-02-06T11:47:05.841Z root INFO Backend d.onStart: 0.2 ms [Finished 0.546 s after backend start]
2025-02-06T11:47:05.842Z root INFO Backend d.configure: 0.1 ms [Finished 0.546 s after backend start]
2025-02-06T11:47:05.842Z root INFO Backend d.initialize: 21.0 ms [Finished 0.546 s after backend start]
2025-02-06T11:47:05.843Z root INFO Backend c.onStart: 0.3 ms [Finished 0.546 s after backend start]
2025-02-06T11:47:05.843Z root INFO Backend a.configure: 3.8 ms [Finished 0.550 s after backend start]
2025-02-06T11:47:05.844Z config INFO >>> Initializing CLI configuration...
2025-02-06T11:47:05.845Z root INFO Backend c.initialize: 0.6 ms [Finished 0.550 s after backend start]
2025-02-06T11:47:05.845Z root INFO Backend x.onStart: 0.7 ms [Finished 0.551 s after backend start]
2025-02-06T11:47:05.845Z config INFO Loading CLI configuration from c:\Users\user00\.arduinoIDE\arduino-cli.yaml...
2025-02-06T11:47:05.846Z daemon INFO Starting daemon from C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\lib\backend\resources\arduino-cli.exe...
2025-02-06T11:47:05.846Z root INFO Backend a.initialize: 0.4 ms [Finished 0.552 s after backend start]
2025-02-06T11:47:05.846Z root INFO Backend w.onStart: 1.1 ms [Finished 0.552 s after backend start]
2025-02-06T11:47:05.846Z root INFO Backend r.configure: 1.7 ms [Finished 0.553 s after backend start]
2025-02-06T11:47:05.846Z discovery-log INFO start
2025-02-06T11:47:05.846Z discovery-log INFO start new deferred
2025-02-06T11:47:05.846Z root INFO Backend d.initialize: 0.5 ms [Finished 0.553 s after backend start]
2025-02-06T11:47:05.846Z root INFO Backend y.onStart: 1.8 ms [Finished 0.555 s after backend start]
2025-02-06T11:47:05.846Z root INFO Backend r.configure: 1.5 ms [Finished 0.555 s after backend start]
2025-02-06T11:47:05.846Z root INFO Backend a.onStart: 0.4 ms [Finished 0.556 s after backend start]
2025-02-06T11:47:05.846Z root INFO Backend h.configure: 0.3 ms [Finished 0.556 s after backend start]
2025-02-06T11:47:05.846Z root INFO Backend s.configure: 0.1 ms [Finished 0.556 s after backend start]
2025-02-06T11:47:05.846Z root INFO Backend l.configure: 0.1 ms [Finished 0.556 s after backend start]
2025-02-06T11:47:05.849Z root INFO Theia app listening on http://127.0.0.1:52764.
2025-02-06T11:47:05.849Z root INFO Finished starting backend application: 3.2 ms [Finished 0.559 s after backend start]
2025-02-06T11:47:06.070Z root WARN The local plugin referenced by local-dir:/c%3A/Users/user00/.arduinoIDE/plugins does not exist.
2025-02-06T11:47:06.070Z root WARN The local plugin referenced by local-dir:/c%3A/Users/user00/.arduinoIDE/extensions does not exist.
2025-02-06T11:47:06.070Z root WARN The local plugin referenced by local-dir:C:\Users\user00\.arduinoIDE\plugins does not exist.
2025-02-06T11:47:06.072Z config INFO Loading CLI configuration from c:\Users\user00\.arduinoIDE\arduino-cli.yaml...
2025-02-06T11:47:06.296Z config INFO Loaded CLI configuration: {"board_manager":{"additional_urls":[]}}
2025-02-06T11:47:06.296Z config INFO Loading fallback CLI configuration to get 'directories.data' and 'directories.user'2025-02-06T11:47:06.307Z daemon INFO time="2025-02-06T20:47:06+09:00" level=info msg="arduino-cli version 1.1.1"
time="2025-02-06T20:47:06+09:00" level=info msg="Using config file: c:\\Users\\user00\\.arduinoIDE\\arduino-cli.yaml"
time="2025-02-06T20:47:06+09:00" level=info msg="Executing `arduino-cli daemon`"
Daemon is now listening on 127.0.0.1:52765
{"IP":"127.0.0.1","Port":"52765"}
2025-02-06T11:47:06.307Z daemon INFO Daemon is running.
2025-02-06T11:47:06.332Z daemon INFO time="2025-02-06T20:47:06+09:00" level=info msg="Starting download" url="https://downloads.arduino.cc/libraries/library_index.tar.bz2"
2025-02-06T11:47:06.354Z root INFO Resolve plugins list: 509.2 ms [Finished 1.064 s after backend start]
2025-02-06T11:47:06.432Z config INFO Loaded fallback CLI configuration: {"directories":{"user":"C:\\Users\\user00\\Documents\\Arduino","data":"C:\\Users\\user00\\AppData\\Local\\Arduino15"}}
2025-02-06T11:47:06.432Z config INFO Merged CLI configuration with the fallback: {"directories":{"user":"C:\\Users\\user00\\Documents\\Arduino","data":"C:\\Users\\user00\\AppData\\Local\\Arduino15"},"board_manager":{"additional_urls":[]}}
2025-02-06T11:47:06.432Z config INFO Loaded the CLI configuration.
2025-02-06T11:47:06.432Z config INFO Mapped the CLI configuration: {"dataDirUri":"file:///c%3A/Users/user00/AppData/Local/Arduino15","sketchDirUri":"file:///c%3A/Users/user00/Documents/Arduino","additionalUrls":[],"network":"none","locale":"en"}
2025-02-06T11:47:06.432Z config INFO Validating the CLI configuration...
2025-02-06T11:47:06.438Z config INFO The CLI config is valid.
2025-02-06T11:47:06.438Z config INFO <<< Initialized the CLI configuration.
2025-02-06T11:47:07.196Z root INFO Deploy plugins list: 509.2 ms [Finished 1.906 s after backend start]
Opening channel for service path '/services/electron-window'.
Opening channel for service path '/services/ide-updater'.
2025-02-06T11:47:07.826Z root WARN Frontend a.configure took longer than the expected maximum 100 milliseconds: 254.8 ms [Finished 1.877 s after frontend start]
2025-02-06T11:47:07.826Z root WARN A command editor.action.toggleStickyScroll is already registered.
2025-02-06T11:47:48.419Z root ERROR Detected an error response during the gRPC core client initialization: code: 3, message: Error downloading index 'https://downloads.arduino.cc/libraries/library_index.tar.bz2': Get "https://downloads.arduino.cc/libraries/library_index.tar.bz2": dial tcp 104.18.10.21:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
2025-02-06T11:47:48.419Z root ERROR Detected an error response during the gRPC core client initialization: code: 9, message: Loading index file: loading json index file C:\Users\user00\AppData\Local\Arduino15\package_index.json: open C:\Users\user00\AppData\Local\Arduino15\package_index.json: The system cannot find the file specified.
2025-02-06T11:47:48.420Z root ERROR Detected an error response during the gRPC core client initialization: code: 9, message: Error loading hardware platform: discovery builtin:serial-discovery not found
2025-02-06T11:47:48.420Z root ERROR Detected an error response during the gRPC core client initialization: code: 9, message: Error loading hardware platform: discovery builtin:mdns-discovery not found
2025-02-06T11:47:48.420Z root ERROR Detected an error response during the gRPC core client initialization: code: 9, message: Loading index file: reading library_index.json: open C:\Users\user00\AppData\Local\Arduino15\library_index.json: The system cannot find the file specified.
2025-02-06T11:47:48.421Z daemon INFO time="2025-02-06T20:47:48+09:00" level=info msg="Loading hardware from: C:\\Users\\user00\\AppData\\Local\\Arduino15\\packages"
time="2025-02-06T20:47:48+09:00" level=info msg="Loading libraries index file" index="C:\\Users\\user00\\AppData\\Local\\Arduino15\\library_index.json"
time="2025-02-06T20:47:48+09:00" level=info msg="Adding libraries dir" dir="C:\\Users\\user00\\AppData\\Local\\Arduino15\\libraries" isSingleLibrary=false location=ide
time="2025-02-06T20:47:48+09:00" level=info msg="Adding libraries dir" dir="C:\\Users\\user00\\Documents\\Arduino\\libraries" isSingleLibrary=false location=user
2025-02-06T11:47:48.427Z root ERROR The primary packages indexes are missing. Running indexes update before initializing the core gRPC client The index of the cores and libraries must be updated before initializing the core gRPC client.
The following problems were detected during the gRPC client initialization:
[platform-index] - code: 9, message: Loading index file: loading json index file C:\Users\user00\AppData\Local\Arduino15\package_index.json: open C:\Users\user00\AppData\Local\Arduino15\package_index.json: The system cannot find the file specified.
[platform-index] - code: 9, message: Error loading hardware platform: discovery builtin:serial-discovery not found
[platform-index] - code: 9, message: Error loading hardware platform: discovery builtin:mdns-discovery not found
[library-index] - code: 9, message: Loading index file: reading library_index.json: open C:\Users\user00\AppData\Local\Arduino15\library_index.json: The system cannot find the file specified.

2025-02-06T11:47:48.428Z daemon INFO time="2025-02-06T20:47:48+09:00" level=info msg="Updating index" url="https://downloads.arduino.cc/packages/package_index.tar.bz2"
2025-02-06T11:47:48.429Z daemon INFO time="2025-02-06T20:47:48+09:00" level=info msg="Starting download" url="https://downloads.arduino.cc/libraries/library_index.tar.bz2"
2025-02-06T11:47:48.431Z root INFO core-client-provider [library-index] Downloading index: library_index.tar.bz2

2025-02-06T11:47:48.431Z daemon INFO time="2025-02-06T20:47:48+09:00" level=info msg="Starting download" url="https://downloads.arduino.cc/packages/package_index.tar.bz2"
2025-02-06T11:47:48.432Z root INFO core-client-provider [platform-index] Downloading index: package_index.tar.bz2

2025-02-06T11:48:30.504Z root ERROR Failed to update platform, library indexes. Error: 13 INTERNAL: Some indexes could not be updated.
    at t.callErrorFromStatus (C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\lib\backend\main.js:2:921712)
    at Object.onReceiveStatus (C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\lib\backend\main.js:2:949334)
    at Object.onReceiveStatus (C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\lib\backend\main.js:2:942356)
    at C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\lib\backend\main.js:2:1028497
    at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
for call at
    at s.makeServerStreamRequest (C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\lib\backend\main.js:2:949101)
    at s.updateIndex (C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\lib\backend\main.js:2:1013389)
    at C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\lib\backend\main.js:2:778402
    at C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\lib\backend\main.js:2:778750
    at new Promise (<anonymous>)
    at v.doUpdateIndex (C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\lib\backend\main.js:2:778729)
    at v.updatePlatformIndex (C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\lib\backend\main.js:2:778374)
    at v.updateIndex (C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\lib\backend\main.js:2:777742)
    at v.initInstanceWithFallback (C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\lib\backend\main.js:2:776035)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2025-02-06T11:48:30.506Z daemon INFO time="2025-02-06T20:48:30+09:00" level=info msg="Starting download" url="https://downloads.arduino.cc/libraries/library_index.tar.bz2"
Closing channel on service path '/services/electron-window'.
Closing channel on service path '/services/ide-updater'.
Stored workspaces roots:
No sketches were scheduled for deletion.
```
</details>

## 3-3: プロキシ情報を指定（設定ファイルのみ）

次に、参考にしたサイト情報を読みながら、Arduino IDE の設定ファイルにプロキシ情報を設定しました。

参考サイト: [Arduino IDE 2.0.0 (Windows Proxy環境)で起動画面でグルグル](https://zenn.dev/ignorant/scraps/4edf73e9399b57)

```設定ファイルの場所
%USERPROFILE%\.arduinoIDE\arduino-cli.yaml
```

```yaml: 追加する情報
network:
  proxy: http://<username>:<password>@<proxy>:<port>
```

ログを確認すると、設定ファイルは読み込まれているように思われます。
```
2025-02-06T12:00:11.345Z config INFO Loaded CLI configuration: {"board_manager":{"additional_urls":[]},"network":{"proxy":"http://172.16.1.250:15080"}}

2025-02-06T12:00:11.496Z config INFO Mapped the CLI configuration: {"dataDirUri":"file:///c%3A/Users/user00/AppData/Local/Arduino15","sketchDirUri":"file:///c%3A/Users/user00/Documents/Arduino","additionalUrls":[],"network":{"protocol":"http","hostname":"172.16.1.250","password":"","username":"","port":"15080"},"locale":"en"}
```

ただ、残念ながら、一部のファイルはダウンロードに成功しているものの、失敗しているものもいくつか見受けられます。(INFO は成功？ ERROR は i/o timeout で失敗？）

```
2025-02-06T12:00:13.926Z daemon INFO time="2025-02-06T21:00:13+09:00" level=info msg="Updating index" url="https://downloads.arduino.cc/packages/package_index.tar.bz2"
2025-02-06T12:00:13.927Z daemon INFO time="2025-02-06T21:00:13+09:00" level=info msg="Starting download" url="https://downloads.arduino.cc/packages/package_index.tar.bz2"
2025-02-06T12:00:14.455Z daemon INFO time="2025-02-06T21:00:14+09:00" level=info msg="Checking signature" index="C:\\Users\\user00\\AppData\\Local\\Arduino15\\package_index.json" signatureFile="C:\\Users\\user00\\AppData\\Local\\Arduino15\\package_index.json.sig" trusted=true
2025-02-06T12:00:14.456Z daemon INFO time="2025-02-06T21:00:14+09:00" level=info msg="Loading hardware from: C:\\Users\\user00\\AppData\\Local\\Arduino15\\packages"
2025-02-06T12:00:14.459Z daemon INFO time="2025-02-06T21:00:14+09:00" level=info msg="Starting download" url="https://downloads.arduino.cc/monitor/serial-monitor/serial-monitor_v0.14.1_Windows_64bit.zip"
2025-02-06T12:00:44.466Z root ERROR Detected an error response during the gRPC core client initialization: code: 13, message: downloading builtin:serial-monitor@0.14.1 tool: Get "https://downloads.arduino.cc/monitor/serial-monitor/serial-monitor_v0.14.1_Windows_64bit.zip": dial tcp 104.18.11.21:443: i/o timeout
2025-02-06T12:00:44.466Z daemon INFO time="2025-02-06T21:00:44+09:00" level=info msg="Starting download" url="https://downloads.arduino.cc/tools/ctags-5.8-arduino11-pm-i686-mingw32.zip"
2025-02-06T12:01:14.475Z root ERROR Detected an error response during the gRPC core client initialization: code: 13, message: downloading builtin:ctags@5.8-arduino11 tool: Get "https://downloads.arduino.cc/tools/ctags-5.8-arduino11-pm-i686-mingw32.zip": dial tcp 104.18.10.21:443: i/o timeout
2025-02-06T12:01:14.476Z daemon INFO time="2025-02-06T21:01:14+09:00" level=info msg="Starting download" url="https://downloads.arduino.cc/discovery/dfu-discovery/dfu-discovery_v0.1.2_Windows_64bit.zip"
```
</details>

ちなみに、ログに表示されている URL をブラウザに打ち込むと手動でダウンロードでき、ネットワーク環境（プロキシ, ファイアウォール）のログも確認した上で、ネットワーク環境自体は関係なさそうだと判断しています。

<details><summary>実行結果をすべて読む</summary>
```
Arduino IDE 2.3.4
Checking for frontend application configuration customizations. Module path: C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\lib\backend\electron-main.js, destination 'package.json': C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\package.json
Setting 'theia.frontend.config.appVersion' application configuration value to: "2.3.4" (type of string)
Setting 'theia.frontend.config.cliVersion' application configuration value to: "1.1.1" (type of string)
Setting 'theia.frontend.config.buildDate' application configuration value to: "2024-12-03T10:03:03.490Z" (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.4","cliVersion":"1.1.1","buildDate":"2024-12-03T10:03:03.490Z"}
Starting backend process. PID: 796
Using browser-only version of superagent in non-browser environment
Configuration directory URI: 'file:///c%3A/Users/user00/.arduinoIDE'
Configuring to accept webviews on '^.+\.webview\..+$' hostname.
2025-02-06T12:00:11.001Z root INFO Backend Object.initialize: 4.3 ms [Finished 0.530 s after backend start]
2025-02-06T12:00:11.004Z root INFO Backend Object.configure: 3.5 ms [Finished 0.530 s after backend start]
2025-02-06T12:00:11.004Z root INFO Backend s.onStart: 1.9 ms [Finished 0.530 s after backend start]
2025-02-06T12:00:11.005Z root INFO Backend s.configure: 0.3 ms [Finished 0.551 s after backend start]
2025-02-06T12:00:11.006Z root INFO Backend d.onStart: 0.3 ms [Finished 0.551 s after backend start]
2025-02-06T12:00:11.006Z root INFO Backend d.configure: 0.1 ms [Finished 0.551 s after backend start]
2025-02-06T12:00:11.007Z root INFO Backend d.initialize: 20.7 ms [Finished 0.551 s after backend start]
2025-02-06T12:00:11.007Z root INFO Backend c.onStart: 0.2 ms [Finished 0.551 s after backend start]
2025-02-06T12:00:11.008Z root INFO Backend a.configure: 3.8 ms [Finished 0.555 s after backend start]
2025-02-06T12:00:11.010Z config INFO >>> Initializing CLI configuration...
2025-02-06T12:00:11.010Z root INFO Backend c.initialize: 0.6 ms [Finished 0.555 s after backend start]
2025-02-06T12:00:11.010Z root INFO Backend x.onStart: 0.7 ms [Finished 0.556 s after backend start]
2025-02-06T12:00:11.010Z config INFO Loading CLI configuration from c:\Users\user00\.arduinoIDE\arduino-cli.yaml...
2025-02-06T12:00:11.011Z daemon INFO Starting daemon from C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\lib\backend\resources\arduino-cli.exe...
2025-02-06T12:00:11.011Z root INFO Backend a.initialize: 0.4 ms [Finished 0.557 s after backend start]
2025-02-06T12:00:11.011Z root INFO Backend w.onStart: 1.1 ms [Finished 0.557 s after backend start]
2025-02-06T12:00:11.011Z root INFO Backend r.configure: 1.8 ms [Finished 0.558 s after backend start]
2025-02-06T12:00:11.011Z discovery-log INFO start
2025-02-06T12:00:11.011Z discovery-log INFO start new deferred
2025-02-06T12:00:11.011Z root INFO Backend d.initialize: 0.6 ms [Finished 0.558 s after backend start]
2025-02-06T12:00:11.011Z root INFO Backend y.onStart: 2.2 ms [Finished 0.560 s after backend start]
2025-02-06T12:00:11.011Z root INFO Backend r.configure: 1.7 ms [Finished 0.560 s after backend start]
2025-02-06T12:00:11.011Z root INFO Backend a.onStart: 0.4 ms [Finished 0.561 s after backend start]
2025-02-06T12:00:11.011Z root INFO Backend h.configure: 0.3 ms [Finished 0.561 s after backend start]
2025-02-06T12:00:11.011Z root INFO Backend s.configure: 0.1 ms [Finished 0.561 s after backend start]
2025-02-06T12:00:11.011Z root INFO Backend l.configure: 0.1 ms [Finished 0.561 s after backend start]
2025-02-06T12:00:11.014Z root INFO Theia app listening on http://127.0.0.1:53145.
2025-02-06T12:00:11.014Z root INFO Finished starting backend application: 2.6 ms [Finished 0.564 s after backend start]
2025-02-06T12:00:11.121Z root WARN The local plugin referenced by local-dir:/c%3A/Users/user00/.arduinoIDE/plugins does not exist.
2025-02-06T12:00:11.121Z root WARN The local plugin referenced by local-dir:/c%3A/Users/user00/.arduinoIDE/extensions does not exist.
2025-02-06T12:00:11.121Z root WARN The local plugin referenced by local-dir:C:\Users\user00\.arduinoIDE\plugins does not exist.
2025-02-06T12:00:11.345Z config INFO Loaded CLI configuration: {"board_manager":{"additional_urls":[]},"network":{"proxy":"http://172.16.1.250:15080"}}
2025-02-06T12:00:11.345Z config INFO Loading fallback CLI configuration to get 'directories.data' and 'directories.user'
2025-02-06T12:00:11.357Z daemon INFO time="2025-02-06T21:00:11+09:00" level=info msg="arduino-cli version 1.1.1"
time="2025-02-06T21:00:11+09:00" level=info msg="Using config file: c:\\Users\\user00\\.arduinoIDE\\arduino-cli.yaml"
time="2025-02-06T21:00:11+09:00" level=info msg="Executing `arduino-cli daemon`"
Daemon is now listening on 127.0.0.1:53146
{"IP":"127.0.0.1","Port":"53146"}
2025-02-06T12:00:11.357Z daemon INFO Daemon is running.
2025-02-06T12:00:11.387Z daemon INFO time="2025-02-06T21:00:11+09:00" level=info msg="Starting download" url="https://downloads.arduino.cc/libraries/library_index.tar.bz2"
2025-02-06T12:00:11.418Z root INFO Resolve plugins list: 407.7 ms [Finished 0.968 s after backend start]
2025-02-06T12:00:11.495Z config INFO Loaded fallback CLI configuration: {"directories":{"user":"C:\\Users\\user00\\Documents\\Arduino","data":"C:\\Users\\user00\\AppData\\Local\\Arduino15"}}
2025-02-06T12:00:11.495Z config INFO Merged CLI configuration with the fallback: {"directories":{"user":"C:\\Users\\user00\\Documents\\Arduino","data":"C:\\Users\\user00\\AppData\\Local\\Arduino15"},"board_manager":{"additional_urls":[]},"network":{"proxy":"http://172.16.1.250:15080"}}
2025-02-06T12:00:11.495Z config INFO Loaded the CLI configuration.
2025-02-06T12:00:11.496Z config INFO Mapped the CLI configuration: {"dataDirUri":"file:///c%3A/Users/user00/AppData/Local/Arduino15","sketchDirUri":"file:///c%3A/Users/user00/Documents/Arduino","additionalUrls":[],"network":{"protocol":"http","hostname":"172.16.1.250","password":"","username":"","port":"15080"},"locale":"en"}
2025-02-06T12:00:11.496Z config INFO Validating the CLI configuration...
2025-02-06T12:00:11.501Z config INFO The CLI config is valid.
2025-02-06T12:00:11.501Z config INFO <<< Initialized the CLI configuration.
2025-02-06T12:00:12.275Z root INFO Deploy plugins list: 407.7 ms [Finished 1.825 s after backend start]
Opening channel for service path '/services/electron-window'.
Opening channel for service path '/services/ide-updater'.
2025-02-06T12:00:13.038Z root WARN Frontend a.configure took longer than the expected maximum 100 milliseconds: 274.1 ms [Finished 1.933 s after frontend start]
2025-02-06T12:00:13.038Z root WARN A command editor.action.toggleStickyScroll is already registered.
2025-02-06T12:00:13.926Z daemon INFO time="2025-02-06T21:00:13+09:00" level=info msg="Updating index" url="https://downloads.arduino.cc/packages/package_index.tar.bz2"
2025-02-06T12:00:13.927Z daemon INFO time="2025-02-06T21:00:13+09:00" level=info msg="Starting download" url="https://downloads.arduino.cc/packages/package_index.tar.bz2"
2025-02-06T12:00:14.455Z daemon INFO time="2025-02-06T21:00:14+09:00" level=info msg="Checking signature" index="C:\\Users\\user00\\AppData\\Local\\Arduino15\\package_index.json" signatureFile="C:\\Users\\user00\\AppData\\Local\\Arduino15\\package_index.json.sig" trusted=true
2025-02-06T12:00:14.456Z daemon INFO time="2025-02-06T21:00:14+09:00" level=info msg="Loading hardware from: C:\\Users\\user00\\AppData\\Local\\Arduino15\\packages"
2025-02-06T12:00:14.459Z daemon INFO time="2025-02-06T21:00:14+09:00" level=info msg="Starting download" url="https://downloads.arduino.cc/monitor/serial-monitor/serial-monitor_v0.14.1_Windows_64bit.zip"
2025-02-06T12:00:44.466Z root ERROR Detected an error response during the gRPC core client initialization: code: 13, message: downloading builtin:serial-monitor@0.14.1 tool: Get "https://downloads.arduino.cc/monitor/serial-monitor/serial-monitor_v0.14.1_Windows_64bit.zip": dial tcp 104.18.11.21:443: i/o timeout
2025-02-06T12:00:44.466Z daemon INFO time="2025-02-06T21:00:44+09:00" level=info msg="Starting download" url="https://downloads.arduino.cc/tools/ctags-5.8-arduino11-pm-i686-mingw32.zip"
2025-02-06T12:01:14.475Z root ERROR Detected an error response during the gRPC core client initialization: code: 13, message: downloading builtin:ctags@5.8-arduino11 tool: Get "https://downloads.arduino.cc/tools/ctags-5.8-arduino11-pm-i686-mingw32.zip": dial tcp 104.18.10.21:443: i/o timeout
2025-02-06T12:01:14.476Z daemon INFO time="2025-02-06T21:01:14+09:00" level=info msg="Starting download" url="https://downloads.arduino.cc/discovery/dfu-discovery/dfu-discovery_v0.1.2_Windows_64bit.zip"
Closing channel on service path '/services/electron-window'.
Closing channel on service path '/services/ide-updater'.
Stored workspaces roots:
No sketches were scheduled for deletion.
```
</details>

## 3-4: プロキシ情報を指定（環境変数のみ）

先ほどの参考サイトの下部には、環境変数でプロキシ情報を指定すると成功したという報告がありました。

:::note info
ちなみに、環境変数によるプロキシ情報の指定は、Windows 環境ではあまりなじみがなく、Linux 環境でよく見かけるやり方です。
Linux 環境の場合は環境変数による指定に加えて、ソフトウェアごとの設定ファイルにプロキシ情報を指定することも多く感じます。
:::

次のコマンドを `Arduino IDE.exe` が存在するフォルダにて、環境変数を指定して実行します。

```bat: コマンドプロンプト
Rem 環境変数を指定しつつ実行
set HTTP_PROXY=http://<proxy>:<port>
set HTTPS_PROXY=http://<proxy>:<port>
set NO_PROXY=127.0.0.1,localhost
".\Arduino IDE.exe"
```

```powershell: PowerShell
$env:HTTP_PROXY="http://172.16.1.250:15080"
$env:HTTPS_PROXY="http://172.16.1.250:15080"
$env:NO_PROXY="127.0.0.1,localhost"
& ".\Arduino IDE.exe"
```

すると、またもや一部のファイルのダウンロードに失敗してしまいます。

```
2025-02-06T11:51:24.850Z daemon INFO time="2025-02-06T20:51:24+09:00" level=info msg="Starting download" url="https://downloads.arduino.cc/libraries/library_index.tar.bz2"
2025-02-06T11:52:06.920Z root ERROR Detected an error response during the gRPC core client initialization: code: 3, message: Error downloading index 'https://downloads.arduino.cc/libraries/library_index.tar.bz2': Get "https://downloads.arduino.cc/libraries/library_index.tar.bz2": dial tcp 104.18.10.21:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
```

<details><summary>実行結果をすべて読む</summary>

```
Arduino IDE 2.3.4
Checking for frontend application configuration customizations. Module path: C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\lib\backend\electron-main.js, destination 'package.json': C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\package.json
Setting 'theia.frontend.config.appVersion' application configuration value to: "2.3.4" (type of string)
Setting 'theia.frontend.config.cliVersion' application configuration value to: "1.1.1" (type of string)
Setting 'theia.frontend.config.buildDate' application configuration value to: "2024-12-03T10:03:03.490Z" (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.4","cliVersion":"1.1.1","buildDate":"2024-12-03T10:03:03.490Z"}
Starting backend process. PID: 3004
Using browser-only version of superagent in non-browser environment
Configuration directory URI: 'file:///c%3A/Users/user00/.arduinoIDE'
Configuring to accept webviews on '^.+\.webview\..+$' hostname.
2025-02-06T11:50:00.326Z root INFO Backend Object.initialize: 4.0 ms [Finished 0.530 s after backend start]
2025-02-06T11:50:00.330Z root INFO Backend Object.configure: 3.4 ms [Finished 0.530 s after backend start]
2025-02-06T11:50:00.330Z root INFO Backend s.onStart: 1.9 ms [Finished 0.530 s after backend start]
2025-02-06T11:50:00.330Z root INFO Backend s.configure: 0.3 ms [Finished 0.551 s after backend start]
2025-02-06T11:50:00.331Z root INFO Backend d.onStart: 0.2 ms [Finished 0.551 s after backend start]
2025-02-06T11:50:00.332Z root INFO Backend d.configure: 0.1 ms [Finished 0.551 s after backend start]
2025-02-06T11:50:00.333Z root INFO Backend d.initialize: 20.8 ms [Finished 0.551 s after backend start]
2025-02-06T11:50:00.333Z root INFO Backend c.onStart: 0.2 ms [Finished 0.551 s after backend start]
2025-02-06T11:50:00.334Z root INFO Backend a.configure: 3.8 ms [Finished 0.555 s after backend start]
2025-02-06T11:50:00.335Z config INFO >>> Initializing CLI configuration...
2025-02-06T11:50:00.335Z root INFO Backend c.initialize: 0.5 ms [Finished 0.555 s after backend start]
2025-02-06T11:50:00.335Z root INFO Backend x.onStart: 0.9 ms [Finished 0.556 s after backend start]
2025-02-06T11:50:00.336Z config INFO Loading CLI configuration from c:\Users\user00\.arduinoIDE\arduino-cli.yaml...
2025-02-06T11:50:00.336Z daemon INFO Starting daemon from C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\lib\backend\resources\arduino-cli.exe...
2025-02-06T11:50:00.336Z root INFO Backend a.initialize: 0.4 ms [Finished 0.557 s after backend start]
2025-02-06T11:50:00.336Z root INFO Backend w.onStart: 1.3 ms [Finished 0.558 s after backend start]
2025-02-06T11:50:00.336Z root INFO Backend r.configure: 2.1 ms [Finished 0.558 s after backend start]
2025-02-06T11:50:00.337Z discovery-log INFO start
2025-02-06T11:50:00.337Z discovery-log INFO start new deferred
2025-02-06T11:50:00.337Z root INFO Backend d.initialize: 0.5 ms [Finished 0.559 s after backend start]
2025-02-06T11:50:00.337Z root INFO Backend y.onStart: 1.9 ms [Finished 0.560 s after backend start]
2025-02-06T11:50:00.337Z root INFO Backend r.configure: 1.6 ms [Finished 0.560 s after backend start]
2025-02-06T11:50:00.337Z root INFO Backend a.onStart: 0.4 ms [Finished 0.561 s after backend start]
2025-02-06T11:50:00.337Z root INFO Backend h.configure: 0.3 ms [Finished 0.561 s after backend start]
2025-02-06T11:50:00.337Z root INFO Backend s.configure: 0.1 ms [Finished 0.561 s after backend start]
2025-02-06T11:50:00.337Z root INFO Backend l.configure: 0.1 ms [Finished 0.561 s after backend start]
2025-02-06T11:50:00.339Z root INFO Theia app listening on http://127.0.0.1:52929.
2025-02-06T11:50:00.339Z root INFO Finished starting backend application: 2.9 ms [Finished 0.564 s after backend start]
2025-02-06T11:50:00.456Z root WARN The local plugin referenced by local-dir:/c%3A/Users/user00/.arduinoIDE/plugins does not exist.
2025-02-06T11:50:00.456Z root WARN The local plugin referenced by local-dir:/c%3A/Users/user00/.arduinoIDE/extensions does not exist.
2025-02-06T11:50:00.457Z root WARN The local plugin referenced by local-dir:C:\Users\user00\.arduinoIDE\plugins does not exist.
2025-02-06T11:50:00.673Z config INFO Loaded CLI configuration: {"board_manager":{"additional_urls":[]}}
2025-02-06T11:50:00.673Z config INFO Loading fallback CLI configuration to get 'directories.data' and 'directories.user'
2025-02-06T11:50:00.681Z daemon INFO time="2025-02-06T20:50:00+09:00" level=info msg="arduino-cli version 1.1.1"
time="2025-02-06T20:50:00+09:00" level=info msg="Using config file: c:\\Users\\user00\\.arduinoIDE\\arduino-cli.yaml"
time="2025-02-06T20:50:00+09:00" level=info msg="Executing `arduino-cli daemon`"
Daemon is now listening on 127.0.0.1:52930
{"IP":"127.0.0.1","Port":"52930"}
2025-02-06T11:50:00.681Z daemon INFO Daemon is running.
2025-02-06T11:50:00.715Z daemon INFO time="2025-02-06T20:50:00+09:00" level=info msg="Starting download" url="https://downloads.arduino.cc/libraries/library_index.tar.bz2"
2025-02-06T11:50:00.747Z root INFO Resolve plugins list: 411.2 ms [Finished 0.971 s after backend start]
2025-02-06T11:50:00.827Z config INFO Loaded fallback CLI configuration: {"directories":{"user":"C:\\Users\\user00\\Documents\\Arduino","data":"C:\\Users\\user00\\AppData\\Local\\Arduino15"}}
2025-02-06T11:50:00.827Z config INFO Merged CLI configuration with the fallback: {"directories":{"user":"C:\\Users\\user00\\Documents\\Arduino","data":"C:\\Users\\user00\\AppData\\Local\\Arduino15"},"board_manager":{"additional_urls":[]}}
2025-02-06T11:50:00.827Z config INFO Loaded the CLI configuration.
2025-02-06T11:50:00.828Z config INFO Mapped the CLI configuration: {"dataDirUri":"file:///c%3A/Users/user00/AppData/Local/Arduino15","sketchDirUri":"file:///c%3A/Users/user00/Documents/Arduino","additionalUrls":[],"network":"none","locale":"en"}
2025-02-06T11:50:00.828Z config INFO Validating the CLI configuration...
2025-02-06T11:50:00.832Z config INFO The CLI config is valid.
2025-02-06T11:50:00.832Z config INFO <<< Initialized the CLI configuration.
2025-02-06T11:50:01.574Z root INFO Deploy plugins list: 411.2 ms [Finished 1.798 s after backend start]
Opening channel for service path '/services/electron-window'.
Opening channel for service path '/services/ide-updater'.
2025-02-06T11:50:02.279Z root WARN Frontend a.configure took longer than the expected maximum 100 milliseconds: 235.0 ms [Finished 1.841 s after frontend start]
2025-02-06T11:50:02.279Z root WARN A command editor.action.toggleStickyScroll is already registered.
2025-02-06T11:50:42.787Z root ERROR Detected an error response during the gRPC core client initialization: code: 3, message: Error downloading index 'https://downloads.arduino.cc/libraries/library_index.tar.bz2': Get "https://downloads.arduino.cc/libraries/library_index.tar.bz2": dial tcp 104.18.10.21:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
2025-02-06T11:50:42.788Z root ERROR Detected an error response during the gRPC core client initialization: code: 9, message: Loading index file: loading json index file C:\Users\user00\AppData\Local\Arduino15\package_index.json: open C:\Users\user00\AppData\Local\Arduino15\package_index.json: The system cannot find the file specified.
2025-02-06T11:50:42.788Z daemon INFO time="2025-02-06T20:50:42+09:00" level=info msg="Loading hardware from: C:\\Users\\user00\\AppData\\Local\\Arduino15\\packages"
2025-02-06T11:50:42.788Z root ERROR Detected an error response during the gRPC core client initialization: code: 9, message: Error loading hardware platform: discovery builtin:serial-discovery not found
2025-02-06T11:50:42.788Z root ERROR Detected an error response during the gRPC core client initialization: code: 9, message: Error loading hardware platform: discovery builtin:mdns-discovery not found
2025-02-06T11:50:42.788Z daemon INFO time="2025-02-06T20:50:42+09:00" level=info msg="Loading libraries index file" index="C:\\Users\\user00\\AppData\\Local\\Arduino15\\library_index.json"
2025-02-06T11:50:42.789Z daemon INFO time="2025-02-06T20:50:42+09:00" level=info msg="Adding libraries dir" dir="C:\\Users\\user00\\AppData\\Local\\Arduino15\\libraries" isSingleLibrary=false location=ide
2025-02-06T11:50:42.789Z root ERROR Detected an error response during the gRPC core client initialization: code: 9, message: Loading index file: reading library_index.json: open C:\Users\user00\AppData\Local\Arduino15\library_index.json: The system cannot find the file specified.
2025-02-06T11:50:42.789Z daemon INFO time="2025-02-06T20:50:42+09:00" level=info msg="Adding libraries dir" dir="C:\\Users\\user00\\Documents\\Arduino\\libraries" isSingleLibrary=false location=user
2025-02-06T11:50:42.794Z root ERROR The primary packages indexes are missing. Running indexes update before initializing the core gRPC client The index of the cores and libraries must be updated before initializing the core gRPC client.
The following problems were detected during the gRPC client initialization:
[platform-index] - code: 9, message: Loading index file: loading json index file C:\Users\user00\AppData\Local\Arduino15\package_index.json: open C:\Users\user00\AppData\Local\Arduino15\package_index.json: The system cannot find the file specified.
[platform-index] - code: 9, message: Error loading hardware platform: discovery builtin:serial-discovery not found
[platform-index] - code: 9, message: Error loading hardware platform: discovery builtin:mdns-discovery not found
[library-index] - code: 9, message: Loading index file: reading library_index.json: open C:\Users\user00\AppData\Local\Arduino15\library_index.json: The system cannot find the file specified.

2025-02-06T11:50:42.794Z daemon INFO time="2025-02-06T20:50:42+09:00" level=info msg="Updating index" url="https://downloads.arduino.cc/packages/package_index.tar.bz2"
2025-02-06T11:50:42.796Z daemon INFO time="2025-02-06T20:50:42+09:00" level=info msg="Starting download" url="https://downloads.arduino.cc/libraries/library_index.tar.bz2"
2025-02-06T11:50:42.796Z daemon INFO time="2025-02-06T20:50:42+09:00" level=info msg="Starting download" url="https://downloads.arduino.cc/packages/package_index.tar.bz2"
2025-02-06T11:50:42.797Z root INFO core-client-provider [library-index] Downloading index: library_index.tar.bz2

2025-02-06T11:50:42.798Z root INFO core-client-provider [platform-index] Downloading index: package_index.tar.bz2

2025-02-06T11:51:24.848Z root ERROR Failed to update platform, library indexes. Error: 13 INTERNAL: Error downloading index 'https://downloads.arduino.cc/libraries/library_index.tar.bz2': Get "https://downloads.arduino.cc/libraries/library_index.tar.bz2": dial tcp 104.18.10.21:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
    at t.callErrorFromStatus (C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\lib\backend\main.js:2:921712)
    at Object.onReceiveStatus (C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\lib\backend\main.js:2:949334)
    at Object.onReceiveStatus (C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\lib\backend\main.js:2:942356)
    at C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\lib\backend\main.js:2:1028497
    at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
for call at
    at s.makeServerStreamRequest (C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\lib\backend\main.js:2:949101)
    at s.updateLibrariesIndex (C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\lib\backend\main.js:2:1013389)
    at C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\lib\backend\main.js:2:778557
    at C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\lib\backend\main.js:2:778750
    at new Promise (<anonymous>)
    at v.doUpdateIndex (C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\lib\backend\main.js:2:778729)
    at v.updateLibraryIndex (C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\lib\backend\main.js:2:778529)
    at v.updateIndex (C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\lib\backend\main.js:2:777803)
    at v.initInstanceWithFallback (C:\Users\user00\Downloads\arduino-ide_2.3.4_Windows_64bit\resources\app\lib\backend\main.js:2:776035)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2025-02-06T11:51:24.850Z daemon INFO time="2025-02-06T20:51:24+09:00" level=info msg="Starting download" url="https://downloads.arduino.cc/libraries/library_index.tar.bz2"
2025-02-06T11:52:06.920Z root ERROR Detected an error response during the gRPC core client initialization: code: 3, message: Error downloading index 'https://downloads.arduino.cc/libraries/library_index.tar.bz2': Get "https://downloads.arduino.cc/libraries/library_index.tar.bz2": dial tcp 104.18.10.21:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
2025-02-06T11:52:06.921Z root ERROR Detected an error response during the gRPC core client initialization: code: 9, message: Loading index file: loading json index file C:\Users\user00\AppData\Local\Arduino15\package_index.json: open C:\Users\user00\AppData\Local\Arduino15\package_index.json: The system cannot find the file specified.
2025-02-06T11:52:06.921Z daemon INFO time="2025-02-06T20:52:06+09:00" level=info msg="Loading hardware from: C:\\Users\\user00\\AppData\\Local\\Arduino15\\packages"
2025-02-06T11:52:06.922Z daemon INFO time="2025-02-06T20:52:06+09:00" level=info msg="Loading libraries index file" index="C:\\Users\\user00\\AppData\\Local\\Arduino15\\library_index.json"
2025-02-06T11:52:06.922Z root ERROR Detected an error response during the gRPC core client initialization: code: 9, message: Error loading hardware platform: discovery builtin:serial-discovery not found
2025-02-06T11:52:06.922Z root ERROR Detected an error response during the gRPC core client initialization: code: 9, message: Error loading hardware platform: discovery builtin:mdns-discovery not found
2025-02-06T11:52:06.923Z daemon INFO time="2025-02-06T20:52:06+09:00" level=info msg="Adding libraries dir" dir="C:\\Users\\user00\\AppData\\Local\\Arduino15\\libraries" isSingleLibrary=false location=ide
2025-02-06T11:52:06.923Z root ERROR Detected an error response during the gRPC core client initialization: code: 9, message: Loading index file: reading library_index.json: open C:\Users\user00\AppData\Local\Arduino15\library_index.json: The system cannot find the file specified.
2025-02-06T11:52:06.923Z daemon INFO time="2025-02-06T20:52:06+09:00" level=info msg="Adding libraries dir" dir="C:\\Users\\user00\\Documents\\Arduino\\libraries" isSingleLibrary=false location=user
2025-02-06T11:52:06.925Z root ERROR Uncaught Exception:  Error: The index of the cores and libraries must be updated before initializing the core gRPC client.
The following problems were detected during the gRPC client initialization:
[platform-index] - code: 9, message: Loading index file: loading json index file C:\Users\user00\AppData\Local\Arduino15\package_index.json: open C:\Users\user00\AppData\Local\Arduino15\package_index.json: The system cannot find the file specified.
[platform-index] - code: 9, message: Error loading hardware platform: discovery builtin:serial-discovery not found
[platform-index] - code: 9, message: Error loading hardware platform: discovery builtin:mdns-discovery not found
[library-index] - code: 9, message: Loading index file: reading library_index.json: open C:\Users\user00\AppData\Local\Arduino15\library_index.json: The system cannot find the file specified.

2025-02-06T11:52:06.925Z root ERROR Error: The index of the cores and libraries must be updated before initializing the core gRPC client.
The following problems were detected during the gRPC client initialization:
[platform-index] - code: 9, message: Loading index file: loading json index file C:\Users\user00\AppData\Local\Arduino15\package_index.json: open C:\Users\user00\AppData\Local\Arduino15\package_index.json: The system cannot find the file specified.
[platform-index] - code: 9, message: Error loading hardware platform: discovery builtin:serial-discovery not found
[platform-index] - code: 9, message: Error loading hardware platform: discovery builtin:mdns-discovery not found
[library-index] - code: 9, message: Loading index file: reading library_index.json: open C:\Users\user00\AppData\Local\Arduino15\library_index.json: The system cannot find the file specified.
```

</details>

## 3-5: プロキシ情報を指定（設定ファイル + 環境変数）

プロキシ情報を環境変数で指定するとき、 `HTTP_PROXY` や `HTTPS_PROXY` を設定する必要がありますが、環境によっては `NO_PROXY` の設定も必要になるようです。
おそらく、Arduino IDE 2.0 は Electron が動作しており、内部的には Web サーバの仕組みで動作しているからだと考えています。

インターネット上のファイルをダウンロードするときにはプロキシを経由する必要がありますが、内部 Web サーバへアクセスするときは経由してはいけません。
よって、`127.0.0.1` や `localhost` に対してはプロキシを経由させない設定が必要になっています。

ただ、環境によって違うようなので、詳しいところはよくわかりません。

```
set HTTP_PROXY=http://172.16.1.250:15080
set HTTPS_PROXY=http://172.16.1.250:15080
set NO_PROXY=127.0.0.1,localhost  ← 私の環境だと重要だった
```

他にもつまづきポイントがあり、`Arduino IDE.exe` が読み込む設定ファイルと、トラブルシューティングで使用した `arduino-cli.exe` が読み込む設定ファイルとで異なるケースがあるようです。

```
# Arduino IDE.exe が読み込む設定ファイル
%USERPROFILE%\.arduinoIDE\arduino-cli.yaml

# arduino-cli.exe が読み込む設定ファイル
%USERPROFILE%\Local\Arduino15\arduino-cli.yaml
```

# 4: 最後に
Windows で動くソフトウェアに、Linux しぐさ（設定ファイルや環境変数にプロキシ情報を指定する）を持ち込むのはやめてくれ！と思いました。
しかも、設定ファイルと環境変数の両方に指定しないといけないという落とし穴つきです。
さらに、私の環境では環境変数 NO_PROXY で 127.0.0.1, localhost を除外しないといけない徹底ぶりです。