phacility/phabricator · error · Exception
Unsupported data encoding.
Error message
Unsupported data encoding.
What it means
Encoding whitelist guard in the chunk upload conduit method: dataEncoding is neither 'base64' nor null/omitted. Only those two encodings are supported, so any other declared encoding for the chunk data is rejected before decoding.
Solutions
- Set dataEncoding to 'base64' or omit it entirely
- Do not invent other encoding values in the conduit request
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/applications/files/conduit/FileUploadChunkConduitAPIMethod.php:44 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/8473bce6310b2cab.
Report an issue: GitHub.
Appendix: source
Thrown at src/applications/files/conduit/FileUploadChunkConduitAPIMethod.php:44
protected function execute(ConduitAPIRequest $request) {
$viewer = $request->getUser();
$file_phid = $request->getValue('filePHID');
$file = $this->loadFileByPHID($viewer, $file_phid);
$start = $request->getValue('byteStart');
$data = $request->getValue('data');
$encoding = $request->getValue('dataEncoding');
switch ($encoding) {
case 'base64':
$data = $this->decodeBase64($data);
break;
case null:
break;
default:
throw new Exception(pht('Unsupported data encoding.'));
}
$length = strlen($data);
$chunk = $this->loadFileChunkForUpload(
$viewer,
$file,
$start,
$start + $length);
// If this is the initial chunk, leave the MIME type unset so we detect
// it and can update the parent file. If this is any other chunk, it has
// no meaningful MIME type. Provide a default type so we can avoid writing
// it to disk to perform MIME type detection.
if (!$start) {
$mime_type = null;
} else {
$mime_type = 'application/octet-stream';
}View on GitHub (pinned to 5720a38cfe)