{"record":{"id":"a89d1fdc0c3d9ce4","repo":"phacility/phabricator","slug":"expected-a-list-of-hints-in-json-format-s","errorCode":null,"errorMessage":"Expected a list of hints in JSON format: %s","messagePattern":"Expected a list of hints in JSON format: (.+?)","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"error","filePath":"src/applications/repository/management/PhabricatorRepositoryManagementHintWorkflow.php","lineNumber":31,"sourceCode":"      ->setArguments(array());\n  }\n\n  public function execute(PhutilArgumentParser $args) {\n    $viewer = $this->getViewer();\n\n    echo tsprintf(\n      \"%s\\n\",\n      pht('Reading list of hints from stdin...'));\n\n    $hints = file_get_contents('php://stdin');\n    if ($hints === false) {\n      throw new PhutilArgumentUsageException(pht('Failed to read stdin.'));\n    }\n\n    try {\n      $hints = phutil_json_decode($hints);\n    } catch (Exception $ex) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Expected a list of hints in JSON format: %s',\n          $ex->getMessage()));\n    }\n\n    $repositories = array();\n    foreach ($hints as $idx => $hint) {\n      if (!is_array($hint)) {\n        throw new PhutilArgumentUsageException(\n          pht(\n            'Each item in the list of hints should be a JSON object, but '.\n            'the item at index \"%s\" is not.',\n            $idx));\n      }\n\n      try {\n        PhutilTypeSpec::checkMap(\n          $hint,","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/repository/management/PhabricatorRepositoryManagementHintWorkflow.php#L13-L49","documentation":"Thrown by `bin/repository hint` when `phutil_json_decode()` raises while parsing the stdin payload, i.e. the bytes read from stdin are not valid JSON. The message embeds the underlying decoder error (unexpected token, unterminated string, trailing commas, etc.). It aborts before any hint is written to the `repository_commit_hint` table.","triggerScenarios":"Piping a bare string or shell-quoted text instead of JSON (`echo 'cleanup' | ./bin/repository hint`); JSON with trailing commas, single-quoted keys, or unescaped newlines; a truncated file (transfer cut off, or `head` used on it); an empty stdin read as '' which json_decode rejects; BOM-prefixed JSON saved from a Windows editor.","commonSituations":"Hand-writing the hints file and forgetting array brackets; generating it with string interpolation that breaks quoting (`echo \"[{old: $sha}]\"`); files edited on Windows with a BOM; piping through a command that emits a warning line before the JSON.","solutions":["Validate before piping: `php -r 'exit(json_decode(file_get_contents(\"hints.json\")) === null ? 1 : 0);' && ./bin/repository hint < hints.json`.","Re-save the file as UTF-8 without BOM and remove trailing commas / comments.","Regenerate the JSON with `json_encode` (PHP) or `jq -c . hints.json > clean.json` to normalize it.","Read the embedded decoder message in the exception — it names the exact byte offset of the syntax error."],"exampleFix":"// before\n$ echo \"hints for old sha\" | ./bin/repository hint\n[1161] Expected a list of hints in JSON format: Syntax error\n\n// after\n$ cat > hints.json <<'EOF'\n[{\"repository\":\"R1\",\"old\":\"deadbeef\",\"hint\":\"obsolete ref\"}]\nEOF\n$ ./bin/repository hint < hints.json","handlingStrategy":"validation","validationCode":"php -r '$d = json_decode(file_get_contents($argv[1]), true); if (json_last_error() !== JSON_ERROR_NONE) { fwrite(STDERR, json_last_error_msg().\"\\n\"); exit(1); }' hints.json && ./bin/repository hint < hints.json","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Generate hint files with json_encode/jq instead of hand-writing them.","Keep JSON one-entry-per-line (or run through `jq -c .`) so diffs and truncation are visible.","Never let shell warnings or progress output share the pipe with the JSON payload."],"tags":["phabricator","phorge","json","cli","repository-management"],"backgroundTag":"invalid-json-input","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}