DBFS append mode silently overwrites existing files

Open Beginner friendly
#2,429 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@IlyaKhalafi is already working on this.

Since Nov 4, 2026.

  • #2431 by @IlyaKhalafi — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
77/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
backend

Research direction

Start by reading the DBFS implementation around _initiate_upload and its tests for binary and text append modes. Check how the create request sets overwrite and how unsupported modes are handled. Done means append mode is rejected before opening an upload, with tests confirming existing file contents are not silently overwritten.

Written by the indexing model from the issue text.

Description

DBFS accepts append mode, but _initiate_upload creates the destination with overwrite=True for every mode except xb. Existing contents are discarded, so appending behaves like overwriting.

with fs.open("/existing", "ab") as file:
    file.write(b"appended")

I reproduced the request sequence on current master with a mocked DBFS API using its documented create/overwrite behavior. Starting with b"original" leaves only b"appended". The requests are create with overwrite=True, add-block, then close. Text append mode has the same issue.

The DBFS create endpoint supports creating or overwriting a file, and add-block appends to that newly created stream. It does not reopen an existing file for append. Rejecting append mode before opening an upload would prevent silent data loss.

Dominant language
Python
Stars
1.4k
Forks
570
Avg merge
2d 18h
Merged PRs (30d)
102

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from fsspec/filesystem_spec

All issues in fsspec/filesystem_spec

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.