phacility/phabricator · error · PhutilArgumentUsageException
Unable to calculate , this subscription has not been…
Error message
Unable to calculate %s, this subscription has not been scheduled for billing yet. Wait for the trigger daemon to schedule the subscription.
What it means
PhutilArgumentUsageException thrown by the phortune invoice workflow in the --auto-range branch when the subscription's trigger has no scheduled event ($trigger->getEvent() is null). --auto-range derives the billing window from PhabricatorScheduledTriggerEvent's last/next epochs; if the trigger daemon has never processed this subscription's trigger, those epochs do not exist and the range cannot be computed. The fix is scheduling, not argument changes.
Solutions
- Start the daemons with `bin/phd start` and wait for the trigger daemon to schedule the subscription (check `bin/phd status` and the trigger queue).
- If you cannot wait, bypass --auto-range and pass explicit --last/--next epochs matching the intended billing period.
- Verify the subscription shows a next billing date in the UI before retrying --auto-range.
Example fix
# before $ ./bin/phortune invoice --subscription PHID-PSUB-1234abcd --auto-range # -> error: not scheduled for billing yet # after $ ./bin/phortune start # or: bin/phd start; wait one scheduling cycle $ ./bin/phortune invoice --subscription PHID-PSUB-1234abcd --auto-range # or, without daemons: $ ./bin/phortune invoice --subscription PHID-PSUB-1234abcd --last 1690000000 --next 1692600000
Defensive patterns
Strategy: validation
Validate before calling
// Before using --auto-range, confirm the subscription is scheduled.
$trigger = $subscription->getTrigger();
$event = ($trigger ? $trigger->getEvent() : null);
if (!$event || !$event->getNextEventEpoch()) {
// Not scheduled yet: start daemons and wait, or fall back to --last/--next.
} Prevention
- Run `bin/phd start` in any environment using Phortune scheduling; check `bin/phd status` for the trigger daemon.
- After creating a subscription, wait one trigger cycle before manual auto-range invoicing.
- In daemons-off test environments, always invoice with explicit --last/--next.
When it happens
Trigger: Running `... --auto-range` on a brand-new subscription before the trigger daemon (phd) has ever fired; running with the daemons stopped; a subscription whose trigger was created but never activated. The code path: $subscription->getTrigger()->getEvent() returns null.
Common situations: Fresh Phortune test installs where phd isn't running (common in dev sandboxes); subscriptions created moments before invoicing; environments where the trigger daemon loop is disabled.
Related errors
- Declining to invoice.
- Specify a billing range with
- Specify which subscription to invoice with
- Unable to load subscription with PHID
- Use either or and to specify the billing range, but not…
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/82f3421a31e738b4.
Report an issue: GitHub.
Appendix: source
Thrown at src/applications/phortune/management/PhabricatorPhortuneManagementInvoiceWorkflow.php:120
'to define the beginning and end of the billing range.',
'--last',
'--next'));
} else if (!$auto_range && ($last_arg && $next_arg)) {
$last_time = $this->parseTimeArgument($args->getArg('last'));
$next_time = $this->parseTimeArgument($args->getArg('next'));
} else if ($auto_range && ($last_arg || $next_arg)) {
throw new PhutilArgumentUsageException(
pht(
'Use either %s or %s and %s to specify the '.
'billing range, but not both.',
'--auto-range',
'--last',
'--next'));
} else {
$trigger = $subscription->getTrigger();
$event = $trigger->getEvent();
if (!$event) {
throw new PhutilArgumentUsageException(
pht(
'Unable to calculate %s, this subscription has not been '.
'scheduled for billing yet. Wait for the trigger daemon to '.
'schedule the subscription.',
'--auto-range'));
}
$last_time = $event->getLastEventEpoch();
$next_time = $event->getNextEventEpoch();
}
$console->writeOut(
"%s\n",
pht(
'Preparing to invoice subscription "%s" from %s to %s.',
$subscription->getSubscriptionName(),
($last_time
? phabricator_datetime($last_time, $viewer)
: pht('subscription creation')),View on GitHub (pinned to 5720a38cfe)