Fix action cache cold start crash on empty output base - #43
Merged
azad-uber-2 merged 1 commit intoJul 16, 2026
Merged
Conversation
The deleteUnrecognizedFiles method (backported from Bazel 9 in #41) calls cacheRoot.getDirectoryEntries() without checking if the action_cache directory exists. On a cold cache (fresh output base), the directory hasn't been created yet, causing an IOException: 'No such file or directory'. Bazel 7 doesn't have this issue because it lacks deleteUnrecognizedFiles. The fix adds an existence check at the top of the method, returning early if the directory doesn't exist yet (there are no files to clean up anyway).
jbarr21
self-requested a review
July 16, 2026 22:05
jbarr21
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The deleteUnrecognizedFiles method (backported from Bazel 9 in #41) calls cacheRoot.getDirectoryEntries() without checking if the action_cache directory exists. On a cold cache (fresh output base), the directory hasn't been created yet, causing an IOException: 'No such file or directory'.
Bazel 7 doesn't have this issue because it lacks deleteUnrecognizedFiles.
The fix adds an existence check at the top of the method, returning early if the directory doesn't exist yet (there are no files to clean up anyway).
This is a follow-up fix to #41 which backported deleteUnrecognizedFiles from Bazel 9. That method calls cacheRoot.getDirectoryEntries() without checking if the action_cache directory exists first. On a cold cache (fresh output base with no prior builds), the directory hasn't been created yet, causing a crash: Couldn't create action cache: .../action_cache (No such file or directory). Bazel 7 is unaffected because it doesn't have deleteUnrecognizedFiles. The fix adds an early return when the directory doesn't exist — there are no files to clean up on a cold cache anyway, so the cleanup logic from #41 is preserved for all other scenarios.