Lesstep
GitHub Actions・2026年11月3日に確認

GitHub Actions:「Failed to save: Unable to reserve cache with key」

ジョブの終わりのキャッシュの保存が行われず、ジョブ自体は成功のままです。この行は GitHub の actions toolkit のキャッシュのパッケージが出すもので、actions/cache も、setup-node・setup-go・setup-uv などに組み込みのキャッシュも、これを使っています。同じ書き出しのあとに2通りの終わり方があり、意味が違います。

2つの行

キーがもうある

2026年10月28日、pymovements の main への push から(これを止めるプルリクエストは pymovements #1788):

Run actions/cache/save@v4
...
[command]/usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /home/runner/work/pymovements/pymovements --files-from manifest.txt --use-compress-program zstdmt
Failed to save: Unable to reserve cache with key test-ubuntu-latest-py3.13-4ec5...c7b4, another job may be creating this cache.
##[warning]Cache save failed.

よくある出どころ:

ジョブどうしが同じファイルを保存するなら、害はありません。勝ったジョブが保存し、あとの実行はそれを復元します。害があるのは、1つのキーの下でジョブごとに違うファイルを作るとき、たとえば同じ OS でコンパイラーを変えるマトリックスです。ほかのジョブは別の設定で作ったファイルを復元するので、そのマトリックスの値をキーに入れます。

止め方

復元で外れたときだけ保存し、キーは中身を決めるファイルから作ります:

- uses: actions/cache/restore@v6
  id: cache-restore
  with:
    path: ~/.cache/pip
    key: pip-${{ runner.os }}-${{ hashFiles('requirements*.txt') }}
    restore-keys: pip-${{ runner.os }}-

# ... install and test ...

- uses: actions/cache/save@v6
  if: steps.cache-restore.outputs.cache-hit != 'true'
  with:
    path: ~/.cache/pip
    key: ${{ steps.cache-restore.outputs.cache-primary-key }}

この実行は復元しかできない

2026年10月11日、pull_request_target の実行から(sc4pac-actions #12):

##[warning]Failed to save: Unable to reserve cache with key sc4pac-download-cache-80c6c006f143. More details: cache write denied: token has no writable scopes

GitHub が勧めていること:

jobs:
  test:
    runs-on: ubuntu-latest
    cache-mode: read   # read, write, write-only or none
    steps:
      - uses: actions/cache/restore@v6
        with:
          path: ~/.cache/pip
          key: pip-${{ runner.os }}-${{ hashFiles('requirements*.txt') }}

ドキュメントには、キャッシュのストレージに設けた予算をリポジトリが超えたときも、支払いが片づくか、使用量が無料の 10 GB を下回るまで、キャッシュは読み取り専用になる、ともあります。

見分け方

失敗したジョブを IntelliJ IDEA から見るなら

Pipeline Inbox for GitHub Actions Workflows は、Lesstep が作っている JetBrains IDE(2024.1 以降)のプラグインです。すべてのリポジトリの実行を、ジョブ・ステップと一緒に IDE のツールウィンドウに並べ、いまのブランチの実行はステータスバーに出ます。読むのは無料、失敗したジョブの再実行・キャンセル・ワークフローの実行・デプロイのレビューは Pro(月 US$1.50・30日の無料試用つき)です。

GitHub と GitHub Actions は GitHub, Inc. の商標、IntelliJ IDEA は JetBrains s.r.o. の商標です。このページは GitHub, Inc.・JetBrains のいずれとも提携しておらず、承認も受けていません。

ほかに:「Unexpected input(s)」の警告 · 「Artifact storage quota has been hit」 · 「Input required and not supplied」 · 「Cache not found for input keys」 · IntelliJ IDEA で使える GitHub Actions のプラグインの比較 · English