0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

[VSCode / Claude] リモートサーバ上で、 VSCode 拡張の Claude がタイムアウトする ── Amazon Bedrock API の Claude を使用しているときの対策

0
Posted at

1. 概要

VSCode で Claude のパネルを開くと、60 秒待たされたあと、以下のようなエラーが表示される場合がある。
ローカルマシンでは全く同じ設定で動いているのに、リモートサーバ上ではうまくいかなかった。

Error: Subprocess initialization did not complete within 60000ms
— check authentication and network connectivity

image.png

ちなみに、 VSCode のタブ全体像は、以下のような状態。

スクリーンショット 2026-09-01 9.28.51.png

英語で、「認証とネットワークを確認しろ」と書かれているが、認証情報は正しく、ネットワークも通っていた。

こうした場合にどう対処すべきかを、この記事に記載する。

2. 前提

上記の問題は、以下の環境で発生していました。

項目 内容 / version など
OS Ubuntu
VSCode 1.108.1
接続方法 VSCode 拡張の、 VSCode Remote-SSH で接続。拡張はリモート側で動く
Claude 拡張 anthropic.claude-code 2.1.2512.1.252
モデルの提供元 Amazon Bedrock(CLAUDE_CODE_USE_BEDROCK=1)、us.anthropic.claude-opus-5
Bedrock 認証方法 Bedrock API キーAWS_BEARER_TOKEN_BEDROCK)だけを設定ファイルに置いている
aws cli インストールしていない(後述のとおり、この症状には無関係)
CLI 用の claude インストールしていない
VSCode 拡張に同梱されている CLI だけで動かしている

なお、Bedrock API の認証情報などの記述は settings.local.json に対して以下のように行っていた。

  • ~/.claude/settings.local.json
{
  "env": {
    "CLAUDE_CODE_USE_BEDROCK": "1",
    "AWS_REGION": "us-east-1",
    "AWS_BEARER_TOKEN_BEDROCK": "xxxxxxxxxxxx",
  }
}

※ "xxxxxxxxxxxx" の部分には Bedrock API のトークンを設定しています。

3. 切り分け

この記事の対策が効きそうかどうかは、この「3. 切り分け」に記載されている方法で判断してください。

3-1. 拡張機能の output (出力) を開く

以下の画像の通り、まず VSCode ターミナルの真上にある「出力」(Output) タブを選択し、次に、拡張機能を選択するリストボックスをクリックしてください。私の場合は「Remote - SSH」と記述されているリストボックスがそれでした。

スクリーンショット 2026-09-01 18.39.52.png

リストボックスの候補のうち、「Claude VSCode」という拡張機能名を選択しましょう。

スクリーンショット 2026-09-01 18.40.00.png

3-2. エラー原因につながるログを見つける

拡張機能の output (出力) の中に、以下のようなログがあれば、本記事の対処法が有効な可能性があります。

以下の3つのうち2つと、

探す行 意味
Remote settings: Fetch attempt failed (http_401) 管理設定の取得にかかった時間
Remote settings: Cache still valid (304 Not Modified)
Remote settings: Using cached settings (304)
[3p-probe] bedrock-fallback hit 20000ms deadline 使えるモデルの確認をあきらめた

以下のログを探してください。

探す行 意味 発生までの待ち時間
AWS default-chain credential resolve timed out EC2 のメタデータで応答を待ち、上限に達した 60 秒

もしこれらがあれば、本記事の方法で解決できる可能性があります!(^ワ^*)

4. 対処法

「4-1.」、「4-2.」の順番に実施しましょう!

4-1. リモートサーバ側の設定に環境変数を追記する

VSCode のコマンドパレット (Mac: Cmd+Shift+P、Windows: Ctrl+Shift+P) から、 Preferences: Open Remote Settings (JSON) を開きましょう。

スクリーンショット 2026-09-01 19.32.31.png

開けたら、以下の設定を追加してください。

※ 設定画面の Remote [SSH: ホスト名] タブでも同じ場所が開きます。実体はリモートの
~/.vscode-server/data/Machine/settings.json です。

~/.vscode-server/data/Machine/settings.json
{
    "claudeCode.environmentVariables": [
        { "name": "AWS_EC2_METADATA_DISABLED", "value": "true" }
    ]
}

追加してファイルを保存したら、次に進みます。

4-2. VSCode Window を再読み込み

VSCode のコマンドパレット (Mac: Cmd+Shift+P、Windows: Ctrl+Shift+P) から Developer: Reload Window を実行してください。

スクリーンショット 2026-09-01 19.32.49.png

「4-1.」で記載した設定 (~/.vscode-server/data/Machine/settings.json) はVSCode 起動のたびに読まれるので、 Developer: Reload Window により、設定が有効になります。

4-3. もう一度 Claude 拡張を使ってみる

これで、呼び出しが成功するはずです...!(-人-*)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?