phacility/phabricator · error · Exception

Chunk has already been uploaded.

Error message

Chunk has already been uploaded.

What it means

Idempotency guard in loadFileChunkForUpload: the chunk already has a data file PHID attached, meaning this chunk was previously completed. The server refuses to re-upload/overwrite an already-stored chunk, keeping the chunked upload idempotent.

Solutions

  1. Treat the chunk as already complete and continue with the next missing chunk
  2. Query for missing chunks (loadAnyMissingChunk) instead of re-uploading completed ones
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/applications/files/conduit/FileConduitAPIMethod.php:76 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21). Data as JSON: /api/errors/6649c67516c21199. Report an issue: GitHub.

Appendix: source

Thrown at src/applications/files/conduit/FileConduitAPIMethod.php:76

    $chunk = head($chunks);
    if ($chunk->getByteStart() != $start) {
      throw new Exception(
        pht(
          'Chunk start byte is %d, not %d.',
          $chunk->getByteStart(),
          $start));
    }

    if ($chunk->getByteEnd() != $end) {
      throw new Exception(
        pht(
          'Chunk end byte is %d, not %d.',
          $chunk->getByteEnd(),
          $end));
    }

    if ($chunk->getDataFilePHID()) {
      throw new Exception(
        pht('Chunk has already been uploaded.'));
    }

    return $chunk;
  }

  protected function decodeBase64($data) {
    $data = base64_decode($data, $strict = true);
    if ($data === false) {
      throw new Exception(pht('Unable to decode base64 data!'));
    }
    return $data;
  }

  protected function loadAnyMissingChunk(
    PhabricatorUser $viewer,
    PhabricatorFile $file) {

View on GitHub (pinned to 5720a38cfe)