phacility/phabricator · error · PhutilArgumentUsageException
Unable to parse argument to "--until".
Error message
Unable to parse argument to "--until".
What it means
A PhutilArgumentUsageException from `bin/drydock lease` when --until is given but strtotime() cannot parse it into a positive timestamp. PHP's strtotime() returns false for unparseable input, and false <= 0 is true, so both garbage strings and pre-epoch dates are rejected. The value must be anything strtotime understands, e.g. '2027-01-01' or '+2 hours'.
Source
Thrown at src/applications/drydock/management/DrydockManagementLeaseWorkflow.php:58
),
));
}
public function execute(PhutilArgumentParser $args) {
$viewer = $this->getViewer();
$resource_type = $args->getArg('type');
if (!phutil_nonempty_string($resource_type)) {
throw new PhutilArgumentUsageException(
pht(
'Specify a resource type with "--type".'));
}
$until = $args->getArg('until');
if (phutil_nonempty_string($until)) {
$until = strtotime($until);
if ($until <= 0) {
throw new PhutilArgumentUsageException(
pht(
'Unable to parse argument to "--until".'));
}
}
$count = $args->getArgAsInteger('count');
if ($count < 1) {
throw new PhutilArgumentUsageException(
pht(
'Value provided to "--count" must be a nonzero, positive '.
'number.'));
}
$attributes_file = $args->getArg('attributes');
if (phutil_nonempty_string($attributes_file)) {
if ($attributes_file == '-') {
echo tsprintf(
"%s\n",View on GitHub (pinned to 5720a38cfe)
Solutions
- Use an unambiguous strtotime-compatible format: 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM:SS', '+2 hours', or a plain Unix timestamp string.
- Test the value first: `php -r 'var_dump(strtotime($argv[1]));' -- "<your string>"` should print a positive integer.
- In scripts, validate strtotime() !== false before invoking the CLI.
Example fix
# before bin/drydock lease --type host --until '02/31/2027' # after bin/drydock lease --type host --until '2027-02-28 12:00:00'
Defensive patterns
Strategy: validation
Validate before calling
$ts = strtotime($until);
if ($ts === false || $ts <= 0) {
throw new InvalidArgumentException("Unparseable --until value: {$until}");
}
// pass date('Y-m-d H:i:s', $ts) or the raw timestamp to the CLI Prevention
- Normalize dates to 'YYYY-MM-DD HH:MM:SS' or a Unix timestamp before passing them to --until.
- Remember strtotime() is the parser — when in doubt, test the string with `php -r 'echo strtotime("...");'` first.
When it happens
Trigger: `bin/drydock lease --type host --until 'not-a-date'` or a locale-specific format strtotime does not understand (e.g. '01/02/2027' parsed as US m/d/y when d/m/y was intended, or '2027-13-45').
Common situations: Date strings copied from other tools (ISO 8601 with timezone offsets usually works, exotic formats do not); scripts passing an empty-but-set variable after phutil_nonempty_string passes; human input like 'next thursday after lunch'.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Value provided to "--count" must be a nonzero, positive numb
- Blueprint type "%s" is unrecognized. Valid types are: %s.
- Use "--lease" to specify a lease.
- Specify a command to run.
- Unable to load lease with ID "%s"!
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/80941cbb75d6c1d3.
Report an issue: GitHub.