Various tools/libraries create pseudo folders in GS, for example Tensorflow or using the "Create folder" function in the Google Storage Browser UI.
The code that identifies directories does not handle this properly: https://github.com/remerge/gcsfs/blob/be50a9a8d23a04529c40540a1cc123ce5b3512fc/gcsfs/core.py#L819-L820
The folder name will be an exact match and assumed to be a file on the first invocation. This breaks various other methods like isdir.
How to reproduce:
import gcsfs
import tensorflow as tf
path = "YOUR-BUCKET/foo"
tf.io.gfile.mkdir(f"gs://{path}")
fs = gcsfs.GCSFileSystem()
print(fs.isdir(path)) # => False
print(fs.isdir(path)) # => True
I'll create a PR tomorrow to fix this.