From 42e5dc6b2b99106276a1fe61a42821f8d843f2ad Mon Sep 17 00:00:00 2001 From: Arunesh Dwivedi Date: Fri, 19 Jun 2026 11:26:08 +0000 Subject: [PATCH] fix(terraform_validate): add plugin-cache race error patterns to retry list When TF_PLUGIN_CACHE_DIR is set and multiple terraform validate processes run in parallel, the plugin cache can be in an inconsistent state, causing errors like: - could not retrieve the list of available versions for provider - unexpected value returned by API - plugin is cached but contents have changed - the plugin cache directory is invalid These errors are now caught by match_validate_errors and retried via the existing --retry-once-with-cleanup mechanism. Signed-off-by: Arunesh Dwivedi --- hooks/terraform_validate.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hooks/terraform_validate.sh b/hooks/terraform_validate.sh index 24e9069e4..40fa3206c 100755 --- a/hooks/terraform_validate.sh +++ b/hooks/terraform_validate.sh @@ -58,6 +58,10 @@ function match_validate_errors { "Could not load plugin") return 1 ;; "Missing required provider") return 1 ;; *"there is no package for"*"cached in .terraform/providers") return 1 ;; + *"could not retrieve the list of available versions for provider"*) return 1 ;; + *"unexpected value returned by API"*) return 1 ;; + *"plugin is cached but contents have changed"*) return 1 ;; + *"the plugin cache directory is invalid"*) return 1 ;; esac done < <(jq -rc '.diagnostics[]' <<< "$validate_output")