{"record":{"id":"d80dcbf68b0d6753","repo":"phacility/phabricator","slug":"the-overwrite-flag-can-only-be-used-alongside-d80dcb","errorCode":null,"errorMessage":"The \"--overwrite\" flag can only be used alongside \"--output\".","messagePattern":"The \"--overwrite\" flag can only be used alongside \"--output\"\\.","errorType":"exception","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/infrastructure/storage/management/workflow/PhabricatorStorageManagementRenamespaceWorkflow.php","lineNumber":92,"sourceCode":"          '--from'));\n    }\n\n    $to = $args->getArg('to');\n    if (!strlen($to)) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Specify namespace to rename to with %s.',\n          '--to'));\n    }\n\n\n    $output_file = $args->getArg('output');\n    $is_overwrite = $args->getArg('overwrite');\n    $is_compress = $args->getArg('compress');\n\n    if ($is_overwrite) {\n      if ($output_file === null) {\n        throw new PhutilArgumentUsageException(\n          pht(\n            'The \"--overwrite\" flag can only be used alongside \"--output\".'));\n      }\n    }\n\n    if ($output_file !== null) {\n      if (Filesystem::pathExists($output_file)) {\n        if (!$is_overwrite) {\n          throw new PhutilArgumentUsageException(\n            pht(\n              'Output file \"%s\" already exists. Use \"--overwrite\" '.\n              'to overwrite.',\n              $output_file));\n        }\n      }\n    }\n\n    if ($is_live) {","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementRenamespaceWorkflow.php#L74-L110","documentation":"Thrown by `bin/storage renamespace` when `--overwrite` is passed without `--output`. Without `--output` the workflow streams the renamed dump to stdout, where an overwrite flag has no meaning, so the tool rejects the combination. This is a PhutilArgumentUsageException: nothing runs.","triggerScenarios":"`./bin/storage renamespace ... --overwrite` with no `--output` file, leaving $is_overwrite true and $output_file === null.","commonSituations":"Assembling flags in a script and removing the --output line while debugging; copy-pasting flag sets between two commands; intending to overwrite an earlier file but forgetting the path.","solutions":["Add `--output <file>`, since an overwrite target is what you intended.","Or remove `--overwrite` when piping the result to stdout or into another program."],"exampleFix":"# before\n./bin/storage renamespace --input d.sql --from a --to b --overwrite\n\n# after\n./bin/storage renamespace --input d.sql --from a --to b --output /tmp/out.sql --overwrite","handlingStrategy":"validation","validationCode":"if [ -n \"$OVERWRITE\" ] && [ -z \"$OUT\" ]; then\n  echo 'error: --overwrite requires --output' >&2\n  exit 2\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Build flag lists from a single variable per concern so paired flags stay paired.","Smoke-test wrapper scripts in dry form before scheduling them."],"tags":["phabricator","bin-storage","renamespace","cli","invalid-flag-combination","usage-error"],"backgroundTag":"invalid-flag-combination","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}