phacility/phabricator · error · ConduitException
ERR-NO-PASTE
ERR-NO-PASTE
Error message
Paste may not be empty.
What it means
Conduit error ERR-NO-PASTE, the only error type paste.create defines, returned when the 'content' parameter is null or an empty string (checked with strlen, so '0' is accepted). A paste must contain at least one byte of body text; the check happens before any transaction or policy logic runs.
Source
Thrown at src/applications/paste/conduit/PasteCreateConduitAPIMethod.php:47
}
protected function defineReturnType() {
return 'nonempty dict';
}
protected function defineErrorTypes() {
return array(
'ERR-NO-PASTE' => pht('Paste may not be empty.'),
);
}
protected function execute(ConduitAPIRequest $request) {
$content = $request->getValue('content');
$title = $request->getValue('title');
$language = $request->getValue('language');
if ($content === null || !strlen($content)) {
throw new ConduitException('ERR-NO-PASTE');
}
$title = nonempty($title, pht('Masterwork From Distant Lands'));
$language = nonempty($language, '');
$viewer = $request->getUser();
$paste = PhabricatorPaste::initializeNewPaste($viewer);
$xactions = array();
$xactions[] = id(new PhabricatorPasteTransaction())
->setTransactionType(PhabricatorPasteContentTransaction::TRANSACTIONTYPE)
->setNewValue($content);
$xactions[] = id(new PhabricatorPasteTransaction())
->setTransactionType(PhabricatorPasteTitleTransaction::TRANSACTIONTYPE)
->setNewValue($title);View on GitHub (pinned to 5720a38cfe)
Solutions
- Verify content is a non-empty string before calling paste.create.
- If empty output is legitimate, skip the call or substitute a placeholder body such as '(empty output)'.
- Fix the upstream source: check the file read or command execution that produced the content variable.
Example fix
// before
$result = $conduit->callMethod(
'paste.create',
array(
'content' => $content, // $content is null
));
// after
if ($content === null || !strlen($content)) {
throw new Exception('Refusing to create an empty paste.');
}
$result = $conduit->callMethod(
'paste.create',
array(
'content' => $content,
)); Defensive patterns
Strategy: validation
Validate before calling
if (!is_string($content) || !strlen($content)) {
throw new Exception('Refusing to create an empty paste.');
}
$result = $conduit->callMethod(
'paste.create',
array(
'content' => $content,
)); Type guard
function is_nonempty_paste_content($content) {
return is_string($content) && strlen($content) > 0;
} Try / catch
try {
$result = $conduit->callMethod('paste.create', $params);
} catch (ConduitException $ex) {
if ($ex->getCode() === 'ERR-NO-PASTE') {
// fix the upstream content source and retry with non-empty body
}
} Prevention
- Check content for null/empty before every paste.create call.
- In piping scripts, handle legitimately empty output explicitly (skip or use a placeholder).
- Verify file reads and upstream command exit status before pasting their output.
When it happens
Trigger: Calling the conduit method paste.create with content omitted, set to '', or carried by a variable that evaluated to null (failed file read, wrong array key, upstream command that produced no output).
Common situations: CLI/arcanist snippets piping command output that happens to be empty; reading a missing file into $content; JSON payload typos like 'contents' or 'text' that leave content unset; CI jobs that paste logs which are occasionally empty.
Related errors
- Service "%s" is unrecognized, restricted, or you do not have
- Service type "%s" is unrecognized. Valid types are: %s.
- Transaction value when deleting Almanac properties must be a
- When deleting Almanac properties, each property name must be
- Transaction value when setting Almanac properties must be a
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/ebdd9577a1a2e472.
Report an issue: GitHub.