phacility/phabricator · error · Exception

Unable to decode base64 data!

Error message

Unable to decode base64 data!

What it means

Decoding guard in decodeBase64: base64_decode in strict mode returned false, so the client-supplied 'data' is not valid base64. The conduit request payload (chunk or file data) is malformed at the encoding level before any storage logic runs.

Solutions

  1. Ensure the data field is properly base64-encoded before sending
  2. Check for transport/JSON mangling of the payload (padding, whitespace, unicode)
  3. Send with dataEncoding omitted if raw bytes can be transmitted safely
Defensive patterns

Strategy: validation

When it happens

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

Common situations: See trigger scenarios.

Understand the failure class


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

Appendix: source

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

      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) {

    return $this->newChunkQuery($viewer, $file)
      ->withIsComplete(false)
      ->setLimit(1)
      ->execute();
  }

  private function newChunkQuery(
    PhabricatorUser $viewer,
    PhabricatorFile $file) {

View on GitHub (pinned to 5720a38cfe)