phacility/phabricator · error · Exception

Request parameter "%s" is not formatted properly. Expected a

Error message

Request parameter "%s" is not formatted properly. Expected a JSON object, but encountered a syntax error: %s.

What it means

Thrown by 'bin/repository thaw' when the operator supplies neither a repository list nor '--all-repositories'. The workflow must know which repositories to promote or demote, and because thaw is a destructive cluster-recovery tool it refuses to guess a default target set. Nothing has run when this is raised; it is a pure argument-selection error.

Source

Thrown at src/aphront/AphrontRequest.php:252

    $raw_data = phutil_string_cast($this->requestData[$name]);
    $raw_data = trim($raw_data);
    if (!strlen($raw_data)) {
      return $default;
    }

    if ($raw_data[0] !== '{') {
      throw new Exception(
        pht(
          'Request parameter "%s" is not formatted properly. Expected a '.
          'JSON object, but value does not start with "{".',
          $name));
    }

    try {
      $json_object = phutil_json_decode($raw_data);
    } catch (PhutilJSONParserException $ex) {
      throw new Exception(
        pht(
          'Request parameter "%s" is not formatted properly. Expected a '.
          'JSON object, but encountered a syntax error: %s.',
          $name,
          $ex->getMessage()));
    }

    return $json_object;
  }


  /**
   * @task data
   */
  public function getArr($name, $default = array()) {
    if (isset($this->requestData[$name]) &&
        is_array($this->requestData[$name])) {
      return $this->requestData[$name];

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Append the repository monikers (e.g. 'bin/repository thaw --promote repo-004 R12') to target specific repositories.
  2. Or add '--all-repositories' to affect every repository hosted on the promoted/demoted device.
  3. Check shell scripts for unquoted/empty variables that were meant to expand into the repository list.

Example fix

# before
bin/repository thaw --promote repo-004

# after
bin/repository thaw --promote repo-004 R12
# or
bin/repository thaw --promote repo-004 --all-repositories
Defensive patterns

Strategy: validation

Validate before calling

# Fail early when no selector is present:
if [ -z "$REPOS" ] && [ "$ALL" != "1" ]; then
  echo 'Select repositories via a list or --all-repositories.' >&2
  exit 2
fi

Prevention

When it happens

Trigger: Running 'bin/repository thaw --promote repo-004' with no trailing repository arguments and no '--all-repositories' flag: both $repository_names and $all_repositories are falsy, hitting the 'else if (!$repository_names && !$all_repositories)' branch at PhabricatorRepositoryManagementThawWorkflow.php:121.

Common situations: Operators used to older Phabricator versions where the command defaulted to the device's repositories; scripts built around '--promote <device>' alone; CI jobs that pass the device but construct an empty repo list variable.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21). Data as JSON: /api/errors/b8ac970f1221071d. Report an issue: GitHub.