fsspec / fsspec/s3fs

S3FileSystem.isfile() returns True for a directory-like prefix (key/prefix collision), and the result changes after calling isdir()

Open
#999 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1k
Forks
305
Avg merge
22h 37m
Merged PRs (30d)
4

Description

I have these two objects:

  • s3://my-bucket/some/prefix (an object key exactly equal to the “directory” name)
  • s3://my-bucket/some/prefix/file.txt (an object under that prefix)

Then:

from s3fs import S3FileSystem

fs  = S3FileSystem()

print(fs.isfile('det-study-a/some/prefix/'))  # True
print(fs.isdir('det-study-a/some/prefix/'))  # True
print(fs.isfile('det-study-a/some/prefix/'))  # False
print(fs.isdir('det-study-a/some/prefix/'))  # True

Environment

  • s3fs version: 2025.12.0
  • Python: 3.12

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the key/prefix collision with the Python snippet, then inspect the S3FileSystem.isfile() and isdir() entry points. The fix is done when repeated isfile() and isdir() calls return consistent classifications for the same S3 path, including the exact-key and child-object case.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.