GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — cache: wrap create failures in ReserveCacheError by robherley · Pull Request #1966 · actions/toolkit

Conversation

@robherley

@robherley robherley commented Feb 25, 2025

Copy link
Copy Markdown
Contributor

When we create cache entries, it's normal behavior for multiple jobs to "race" to create the same entry. In the cache v1 implementations, we suppressed these errors with just a normal log statement however in v2 we create an annotation with warning that is confusing folks.

Here's the v1 implementation:

toolkit/packages/cache/src/cache.ts

Lines 402 to 425 in 662b9d9

const reserveCacheResponse = await cacheHttpClient.reserveCache(
key,
paths,
{
compressionMethod,
enableCrossOsArchive,
cacheSize: archiveFileSize
}
)
if (reserveCacheResponse?.result?.cacheId) {
cacheId = reserveCacheResponse?.result?.cacheId
} else if (reserveCacheResponse?.statusCode === 400) {
throw new Error(
reserveCacheResponse?.error?.message ??
`Cache size of ~${Math.round(
archiveFileSize / (1024 * 1024)
)} MB (${archiveFileSize} B) is over the data cap limit, not saving cache.`
)
} else {
throw new ReserveCacheError(
`Unable to reserve cache with key ${key}, another job may be creating this cache. More details: ${reserveCacheResponse?.error?.message}`
)
}

In v2, our client throws an error for a failed request, so we need to wrap that in the ReserveCacheError. That ensures we only emit an info statement, not a warning annotation:

toolkit/packages/cache/src/cache.ts

Lines 564 to 565 in 662b9d9

} else if (typedError.name === ReserveCacheError.name) {
core.info(`Failed to save: ${typedError.message}`)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@robherley
cache: wrap create failures in ReserveCacheError
d096588
@robherley
robherley requested a review from a team as a code owner February 25, 2025 17:51
joshmgross
joshmgross approved these changes Feb 25, 2025
View reviewed changes
@robherley
robherley merged commit 1b9063e into main Feb 25, 2025
@robherley robherley mentioned this pull request Feb 25, 2025
cache: prep v4.0.2 release #1968
Merged
@crazy-max crazy-max mentioned this pull request Feb 26, 2025
cache-image input to enable/disable caching of binfmt image docker/setup-qemu-action#130
Merged
@robherley robherley mentioned this pull request Feb 26, 2025
Bump @actions/cache to v4.0.2 actions/cache#1560
Merged
7 of 10 tasks
@lazka lazka mentioned this pull request Jun 20, 2025
Warnings about updating cache when run in a matrix msys2/setup-msys2#517
Closed
Derrick-MUGISHA pushed a commit to Derrick-MUGISHA/toolkit that referenced this pull request Oct 12, 2026
@robherley
Merge pull request actions#1966 from actions/robherley/wrap-create-ca…
95f30e4
…che-err

cache: wrap create failures in ReserveCacheError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@joshmgross joshmgross joshmgross approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@robherley @joshmgross
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.