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 value does not start with "{".

What it means

Thrown by the Phabricator CLI workflow 'bin/repository thaw' when the operator supplies both an explicit list of repository identifiers and the '--all-repositories' flag. Thaw applies a cluster promote/demote either to named repositories or to every repository hosted on the target device, so providing both selectors is ambiguous and the workflow aborts before touching anything. It is a PhutilArgumentUsageException, meaning nothing has been executed yet.

Source

Thrown at src/aphront/AphrontRequest.php:242

  }


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

    $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;

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Drop '--all-repositories' from the command and keep the explicit repository list (or vice versa), then re-run.
  2. If the intent is 'every repository on the device', keep only '--all-repositories' and remove the trailing repository arguments.
  3. Audit wrapper scripts so the repo list and the flag are mutually exclusive before invoking bin/repository thaw.

Example fix

# before
bin/repository thaw --demote db-001 --all-repositories R4 R5

# after (explicit repositories)
bin/repository thaw --demote db-001 R4 R5

# or (all repositories on the device)
bin/repository thaw --demote db-001 --all-repositories
Defensive patterns

Strategy: validation

Validate before calling

# In wrapper scripts, make the two selectors mutually exclusive before invoking thaw:
if [ -n "$REPOS" ] && [ "$ALL" = "1" ]; then
  echo 'Pass either a repository list or --all-repositories, not both.' >&2
  exit 2
fi
bin/repository thaw --demote "$DEVICE" $REPOS $([ "$ALL" = "1" ] && echo --all-repositories)

Prevention

When it happens

Trigger: Running e.g. 'bin/repository thaw --demote device-1 --all-repositories R12 R13'. The wildcard 'repositories' argument collects R12/R13 while the flag is also true, so the 'if ($repository_names && $all_repositories)' guard at PhabricatorRepositoryManagementThawWorkflow.php:116 fires.

Common situations: Runbook commands copied into wrapper scripts that always add '--all-repositories'; operators tab-completing a previous thaw command and appending repo names on top of the flag; CI automation combining a template command with a dynamic repo list without checking for the flag.

Related errors


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