Skip to content

Fix failing on read-only file system even if the non-existence of file is already cached#4274

Merged
Wauplin merged 2 commits into
mainfrom
skip_if_there
May 27, 2026
Merged

Fix failing on read-only file system even if the non-existence of file is already cached#4274
Wauplin merged 2 commits into
mainfrom
skip_if_there

Conversation

@ydshieh

@ydshieh ydshieh commented May 27, 2026

Copy link
Copy Markdown
Contributor

For security reason, some CI workflows now using read-only (shared) file system of cache (but the cached files are already in the cache directory, from the CI workflows that have write permission).

This PR avoids such failures - add a condition

if not no_exist_file_path.exists():

before trying to create directory and files.

TBH, it's not a hard failure as the log says

Could not cache non-existence of file. Will ignore error and continue. Error: [Errno 30] Read-only file system: '/mnt/cache/hub/datasets--hf-internal-testing--librispeech_asr_dummy/.no_exist/5be91486e11a2d616f4ec5db8d3fd248585ac07a/librispeech_asr_dummy.py'

So it continues anyway. But the logic of this PR change is still valid IMO.

See a failing run

https://github.com/huggingface/transformers-test-ci/actions/runs/26447817457/job/78022469266

and a run that doesn't have this issue (running against this PR)

https://github.com/huggingface/transformers-test-ci/actions/runs/26500105668/job/78038233032

(the fetch hub objects step)


Note

Low Risk
Small guard around optional cache bookkeeping on 404; no change to download success paths or auth.

Overview
When the Hub returns 404 for a file, huggingface_hub records that fact under .no_exist/<commit_hash>/<path> so later lookups can skip the network. The PR skips mkdir/touch when that marker already exists.

That avoids noisy read-only filesystem errors in CI jobs that mount a shared, pre-populated cache (writable in an earlier step, read-only afterward). Behavior is unchanged when the marker is missing and the cache is writable; commit-hash ref caching still runs either way.

Reviewed by Cursor Bugbot for commit 702a8f5. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pinact found unpinned actions in this repo.

Auto-fixable, but outside this PR's diff (run pinact run locally and commit):

  • .github/workflows/claude.yml:28actions/checkout@v4actions/checkout@34e114876b… # v4.3.1
  • .github/workflows/claude.yml:33- actions/checkout@v2- actions/checkout@ee0669bd1c… # v2.7.0
  • .github/workflows/contrib-tests.yml:28- actions/checkout@v2- actions/checkout@ee0669bd1c… # v2.7.0
  • .github/workflows/contrib-tests.yml:30actions/setup-python@v2actions/setup-python@e9aba2c848… # v2.3.4
  • .github/workflows/model_card_consistency_reminder.yml:15actions/checkout@v4actions/checkout@34e114876b… # v4.3.1
  • .github/workflows/python-prerelease.yml:34actions/checkout@v4actions/checkout@34e114876b… # v4.3.1
  • .github/workflows/python-quality.yml:23- actions/checkout@v2- actions/checkout@ee0669bd1c… # v2.7.0
  • .github/workflows/python-quality.yml:25actions/setup-python@v2actions/setup-python@e9aba2c848… # v2.3.4
  • .github/workflows/python-release.yml:16- actions/checkout@v2- actions/checkout@ee0669bd1c… # v2.7.0
  • .github/workflows/python-release.yml:18actions/setup-python@v2actions/setup-python@e9aba2c848… # v2.3.4
  • .github/workflows/python-tests.yml:48- actions/checkout@v2- actions/checkout@ee0669bd1c… # v2.7.0
  • .github/workflows/python-tests.yml:50actions/setup-python@v2actions/setup-python@e9aba2c848… # v2.3.4
  • .github/workflows/python-tests.yml:165codecov/codecov-action@v3codecov/codecov-action@ab904c41d6… # v3.1.6
  • .github/workflows/python-tests.yml:185- actions/checkout@v2- actions/checkout@ee0669bd1c… # v2.7.0
  • .github/workflows/python-tests.yml:187actions/setup-python@v2actions/setup-python@e9aba2c848… # v2.3.4
  • .github/workflows/python-tests.yml:234codecov/codecov-action@v3codecov/codecov-action@ab904c41d6… # v3.1.6
  • .github/workflows/release-conda.yml:22actions/checkout@v1actions/checkout@50fbc622fc… # v1.2.0
  • .github/workflows/release-conda.yml:25conda-incubator/setup-miniconda@v2conda-incubator/setup-miniconda@9f54435e0e… # v2.3.0
  • .github/workflows/style-bot-action.yml:44actions/github-script@v6actions/github-script@d7906e4ad0… # v6.4.1
  • .github/workflows/style-bot-action.yml:66actions/github-script@v6actions/github-script@d7906e4ad0… # v6.4.1
  • .github/workflows/style-bot-action.yml:92actions/checkout@v3actions/checkout@f43a0e5ff2… # v3.6.0
  • .github/workflows/style-bot-action.yml:137actions/github-script@v6actions/github-script@d7906e4ad0… # v6.4.1
  • .github/workflows/style-bot-action.yml:154actions/setup-python@v4actions/setup-python@7f4fc3e22c… # v4.9.1
  • .github/workflows/style-bot-action.yml:229actions/github-script@v6actions/github-script@d7906e4ad0… # v6.4.1
  • .github/workflows/trufflehog.yml:11actions/checkout@v4actions/checkout@34e114876b… # v4.3.1
  • .github/workflows/build_pr_documentation.yaml:12- actions/checkout@v2- actions/checkout@ee0669bd1c… # v2.7.0
  • .github/workflows/build_repocard_examples.yaml:16- actions/checkout@v2- actions/checkout@ee0669bd1c… # v2.7.0
  • .github/workflows/build_repocard_examples.yaml:18actions/setup-python@v2actions/setup-python@e9aba2c848… # v2.3.4
  • .github/workflows/update-inference-types.yaml:17- actions/checkout@v3- actions/checkout@f43a0e5ff2… # v3.6.0
  • .github/workflows/update-inference-types.yaml:22actions/setup-python@v2actions/setup-python@e9aba2c848… # v2.3.4
  • .github/workflows/update-inference-types.yaml:33- actions/checkout@v3- actions/checkout@f43a0e5ff2… # v3.6.0
  • .github/workflows/update-inference-types.yaml:37- actions/setup-node@v3- actions/setup-node@3235b87634… # v3.9.1
  • .github/workflows/update-inference-types.yaml:41pnpm/action-setup@v2pnpm/action-setup@eae0cfeb28… # v2.4.1
  • .github/workflows/update-inference-types.yaml:71peter-evans/create-pull-request@v7peter-evans/create-pull-request@22a9089034… # v7.0.11

Need manual fix (pinact cannot resolve):

  • .github/workflows/build_documentation.yaml:12huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@main → action can't be pinned
  • .github/workflows/trufflehog.yml:15huggingface/doc-builder/.github/workflows/build_main_documentation.yml@main → action can't be pinned
  • .github/workflows/upload_pr_documentation.yaml:11? → action can't be pinned

Comment on lines +1553 to +1559
try:
no_exist_file_path.parent.mkdir(parents=True, exist_ok=True)
no_exist_file_path.touch()
except OSError as e:
logger.error(
f"Could not cache non-existence of file. Will ignore error and continue. Error: {e}"
)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is just indent

@bot-ci-comment

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pinact found unpinned actions in this repo.

Auto-fixable, but outside this PR's diff (run pinact run locally and commit):

  • .github/workflows/model_card_consistency_reminder.yml:15actions/checkout@v6actions/checkout@de0fac2e45… # v6.0.2
  • .github/workflows/python-prerelease.yml:34actions/checkout@v6actions/checkout@de0fac2e45… # v6.0.2
  • .github/workflows/python-quality.yml:23- actions/checkout@v6- actions/checkout@de0fac2e45… # v6.0.2
  • .github/workflows/python-quality.yml:25actions/setup-python@v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/python-tests.yml:22actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/python-tests.yml:57actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/python-tests.yml:174actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/release.yml:293- actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6- actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/release.yml:348- actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6- actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/release.yml:435- actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6- actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/release.yml:555- actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6- actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/release.yml:690- actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6- actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/release.yml:1018actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/style-bot-action.yml:184actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/sync-hf-cli-skill.yml:17actions/checkout@v6actions/checkout@de0fac2e45… # v6.0.2
  • .github/workflows/sync-hf-cli-skill.yml:20actions/setup-python@v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/sync-hf-cli-skill.yml:46actions/create-github-app-token@v3actions/create-github-app-token@bcd2ba4921… # v3.2.0
  • .github/workflows/sync-hf-cli-skill.yml:53actions/checkout@v6actions/checkout@de0fac2e45… # v6.0.2
  • .github/workflows/sync-hf-cli-skill.yml:60astral-sh/setup-uv@v7astral-sh/setup-uv@37802adc94… # v7.6.0
  • .github/workflows/sync-hf-cli-skill.yml:86peter-evans/create-pull-request@v8peter-evans/create-pull-request@5f6978faf0… # v8.1.1
  • .github/workflows/build_repocard_examples.yaml:18actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/update-inference-types.yaml:22actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/update-inference-types.yaml:37- actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6- actions/setup-node@48b55a011b… # v6.4.0
  • .github/workflows/update-inference-types.yaml:71peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8peter-evans/create-pull-request@5f6978faf0… # v8.1.1

@Wauplin Wauplin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine for me, thanks 👍

@Wauplin Wauplin merged commit 07a6ccc into main May 27, 2026
22 of 26 checks passed
@Wauplin Wauplin deleted the skip_if_there branch May 27, 2026 09:46
@huggingface-hub-bot

Copy link
Copy Markdown
Contributor

This PR has been shipped as part of the v1.17.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants