phacility/phabricator · info · Exception
Declining to invoice.
Error message
Declining to invoice.
What it means
Plain Exception thrown by the phortune invoice workflow when the operator answers 'n' to the phutil_console_confirm() prompt 'Really invoice this subscription?'. The prompt appears unless --force was given, because manually invoicing can double-bill if the range overlaps existing invoices. This exception is the script's clean-abort mechanism for an operator decline, not a malfunction: nothing was queued and no state changed.
Source
Thrown at src/applications/phortune/management/PhabricatorPhortuneManagementInvoiceWorkflow.php:156
: pht('subscription creation')),
phabricator_datetime($next_time, $viewer)));
PhabricatorWorker::setRunAllTasksInProcess(true);
if (!$args->getArg('force')) {
$console->writeOut(
"**<bg:yellow> %s </bg>**\n%s\n",
pht('WARNING'),
phutil_console_wrap(
pht(
'Manually invoicing will double bill payment accounts if the '.
'range overlaps an existing or future invoice. This script is '.
'intended for testing and development, and should not be part '.
'of routine billing operations. If you continue, you may '.
'incorrectly overcharge customers.')));
if (!phutil_console_confirm(pht('Really invoice this subscription?'))) {
throw new Exception(pht('Declining to invoice.'));
}
}
PhabricatorWorker::scheduleTask(
'PhortuneSubscriptionWorker',
array(
'subscriptionPHID' => $subscription->getPHID(),
'trigger.last-epoch' => $last_time,
'trigger.this-epoch' => $next_time,
'manual' => true,
),
array(
'objectPHID' => $subscription->getPHID(),
));
return 0;
}
View on GitHub (pinned to 5720a38cfe)
Solutions
- If you actually want the invoice, re-run and confirm with 'y'.
- To skip the prompt deliberately (already understood risks, scripting), pass --force.
- If the prompt surprised you, re-read the warning: verify your range does not overlap an existing invoice before confirming.
Example fix
# before $ ./bin/phortune invoice --subscription PHID-PSUB-1234abcd --auto-range # Really invoice this subscription? [y/N] n # -> Exception: Declining to invoice. # after (intended to proceed, skip prompt) $ ./bin/phortune invoice --subscription PHID-PSUB-1234abcd --auto-range --force
Defensive patterns
Strategy: try-catch
Try / catch
// When embedding the workflow programmatically, treat a decline as a clean exit.
try {
// ... run the invoice workflow ...
} catch (Exception $ex) {
if ($ex->getMessage() === pht('Declining to invoice.')) {
return 0; // operator said no; nothing was queued
}
throw $ex;
} Prevention
- Decide up front: interactive verification (default) or scripted --force; don't automate the prompt.
- When --force is used in cron, double-check the range flags first — the warning it skips is about real double-billing.
- Treat a declined run as a no-op: no PhortuneSubscriptionWorker task is scheduled.
When it happens
Trigger: Running `bin/phortune invoice` without --force and typing 'n' (or anything not accepting) at the confirmation. The PhabricatorWorker task for PhortuneSubscriptionWorker is only scheduled after the guard, so a decline exits before any billing action.
Common situations: Operators testing the manual invoice flow and aborting at the double-billing warning; interactive exploration in dev; automation accidentally reaching the prompt without a TTY or without --force.
Related errors
- Specify which subscription to invoice with %s.
- Unable to load subscription with PHID "%s".
- Specify a billing range with %s and %s, or use %s.
- When specifying %s or %s, you must specify both arguments to
- Use either %s or %s and %s to specify the billing range, but
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/b65b3d9f25dcb826.
Report an issue: GitHub.