{"record":{"id":"b65b3d9f25dcb826","repo":"phacility/phabricator","slug":"declining-to-invoice","errorCode":null,"errorMessage":"Declining to invoice.","messagePattern":"Declining to invoice\\.","errorType":"console","errorClass":"Exception","httpStatus":null,"severity":"info","filePath":"src/applications/phortune/management/PhabricatorPhortuneManagementInvoiceWorkflow.php","lineNumber":156,"sourceCode":"          : pht('subscription creation')),\n        phabricator_datetime($next_time, $viewer)));\n\n    PhabricatorWorker::setRunAllTasksInProcess(true);\n\n    if (!$args->getArg('force')) {\n      $console->writeOut(\n        \"**<bg:yellow> %s </bg>**\\n%s\\n\",\n        pht('WARNING'),\n        phutil_console_wrap(\n          pht(\n            'Manually invoicing will double bill payment accounts if the '.\n            'range overlaps an existing or future invoice. This script is '.\n            'intended for testing and development, and should not be part '.\n            'of routine billing operations. If you continue, you may '.\n            'incorrectly overcharge customers.')));\n\n      if (!phutil_console_confirm(pht('Really invoice this subscription?'))) {\n        throw new Exception(pht('Declining to invoice.'));\n      }\n    }\n\n    PhabricatorWorker::scheduleTask(\n      'PhortuneSubscriptionWorker',\n      array(\n        'subscriptionPHID' => $subscription->getPHID(),\n        'trigger.last-epoch' => $last_time,\n        'trigger.this-epoch' => $next_time,\n        'manual' => true,\n      ),\n      array(\n        'objectPHID' => $subscription->getPHID(),\n      ));\n\n    return 0;\n  }\n","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/phortune/management/PhabricatorPhortuneManagementInvoiceWorkflow.php#L138-L174","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\n$ ./bin/phortune invoice --subscription PHID-PSUB-1234abcd --auto-range\n# Really invoice this subscription? [y/N] n\n# -> Exception: Declining to invoice.\n\n# after (intended to proceed, skip prompt)\n$ ./bin/phortune invoice --subscription PHID-PSUB-1234abcd --auto-range --force","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// When embedding the workflow programmatically, treat a decline as a clean exit.\ntry {\n  // ... run the invoice workflow ...\n} catch (Exception $ex) {\n  if ($ex->getMessage() === pht('Declining to invoice.')) {\n    return 0; // operator said no; nothing was queued\n  }\n  throw $ex;\n}","preventionTips":["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."],"tags":["php","phabricator","phortune","cli","confirmation","billing","aborted"],"backgroundTag":"user-cancelled-operation","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}