{"record":{"id":"7c71a5e16b2ede9b","repo":"phacility/phabricator","slug":"specify-an-export-format-with-format","errorCode":null,"errorMessage":"Specify an export format with \"--format\".","messagePattern":"Specify an export format with \"--format\"\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/applications/transactions/bulk/management/PhabricatorBulkManagementExportWorkflow.php","lineNumber":55,"sourceCode":"              'stdout.'),\n          ),\n          array(\n            'name' => 'overwrite',\n            'help' => pht(\n              'If the output file already exists, overwrite it instead of '.\n              'raising an error.'),\n          ),\n        ));\n  }\n\n  public function execute(PhutilArgumentParser $args) {\n    $viewer = $this->getViewer();\n\n    list($engine, $queries) = $this->newQueries($args);\n\n    $format_key = $args->getArg('format');\n    if (!strlen($format_key)) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Specify an export format with \"--format\".'));\n    }\n\n    $all_formats = PhabricatorExportFormat::getAllExportFormats();\n    $format = idx($all_formats, $format_key);\n    if (!$format) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Unknown export format (\"%s\"). Known formats are: %s.',\n          $format_key,\n          implode(', ', array_keys($all_formats))));\n    }\n\n    if (!$format->isExportFormatEnabled()) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Export format (\"%s\") is not enabled.',","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/transactions/bulk/management/PhabricatorBulkManagementExportWorkflow.php#L37-L73","documentation":"PhabricatorBulkManagementExportWorkflow (bin/bulk export) requires --format to select the export format. An empty value aborts before the format registry is even consulted.","triggerScenarios":"Running ./bin/bulk export without --format, or with an empty string as its value, typically when a script's format variable was never set.","commonSituations":"Wrapper scripts where the format is conditionally assigned; copy-pasting an export command from docs that omitted the flag.","solutions":["Pass a known format key: ./bin/bulk export --format csv ...","Default the format variable in wrapper scripts so it is never empty","Run with an invalid non-empty key once to see the known-formats list in the sibling error"],"exampleFix":"# before\n./bin/bulk export --query ... --output out.csv\n\n# after\n./bin/bulk export --format csv --query ... --output out.csv","handlingStrategy":"validation","validationCode":"# bash: default the format so it is never empty\nFORMAT=\"${FORMAT:-csv}\"\n./bin/bulk export --format \"$FORMAT\" --query \"$QUERY\" --output out.csv","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass --format explicitly in scripts","Fail fast in wrappers when the format variable is empty"],"tags":["cli","usage","export","format"],"backgroundTag":"missing-cli-argument","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}