From f6da037129bdeeccc0c2230d0e0e739ff7f6a669 Mon Sep 17 00:00:00 2001 From: Scott Wittenburg Date: Thu, 8 May 2025 13:54:43 -0600 Subject: [PATCH] binary_distribution: Handle fetch error during rebuild-index (#50387) Allow rebuild-index to continue if fetching some specs fails for any reason, and issue a warning indicating which manifest is associated with the failed fetch. --- lib/spack/spack/binary_distribution.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/spack/spack/binary_distribution.py b/lib/spack/spack/binary_distribution.py index a46b2fcb938..90a54f49390 100644 --- a/lib/spack/spack/binary_distribution.py +++ b/lib/spack/spack/binary_distribution.py @@ -717,7 +717,11 @@ def _read_specs_and_push_index( temp_dir: Location to write index.json and hash for pushing """ for file in file_list: - fetched_spec = spack.spec.Spec.from_dict(read_method(file)) + try: + fetched_spec = spack.spec.Spec.from_dict(read_method(file)) + except Exception as e: + tty.warn(f"Unable to fetch spec for manifest {file} due to: {e}") + continue db.add(fetched_spec) db.mark(fetched_spec, "in_buildcache", True)