phacility/phabricator · error · Exception
Unknown file content request kind
Error message
Unknown file content request kind "%s".
What it means
Raised in PhabricatorFile::getCDNURI() when $request_kind is anything other than 'data' or 'download'. Callers (getViewURI, getDownloadURI, conduit field values) must pass one of the two supported request kinds.
Solutions
- Pass 'data' (inline content) or 'download' (attachment) as the request kind
- Add a unit test asserting only these two kinds are used at call sites
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at src/applications/files/storage/PhabricatorFile.php:840 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/5e58740df90c9a0d.
Report an issue: GitHub.
Appendix: source
Thrown at src/applications/files/storage/PhabricatorFile.php:840
}
public function getURI() {
return $this->getInfoURI();
}
public function getViewURI() {
if (!$this->getPHID()) {
throw new Exception(
pht('You must save a file before you can generate a view URI.'));
}
return $this->getCDNURI('data');
}
public function getCDNURI($request_kind) {
if (($request_kind !== 'data') &&
($request_kind !== 'download')) {
throw new Exception(
pht(
'Unknown file content request kind "%s".',
$request_kind));
}
$name = self::normalizeFileName($this->getName());
$name = phutil_escape_uri($name);
$parts = array();
$parts[] = 'file';
$parts[] = $request_kind;
// If this is an instanced install, add the instance identifier to the URI.
// Instanced configurations behind a CDN may not be able to control the
// request domain used by the CDN (as with AWS CloudFront). Embedding the
// instance identity in the path allows us to distinguish between requests
// originating from different instances but served through the same CDN.
$instance = PhabricatorEnv::getEnvConfig('cluster.instance');View on GitHub (pinned to 5720a38cfe)