{"record":{"id":"9d09866e3f54c26f","repo":"phacility/phabricator","slug":"error-while-reading-s-s","errorCode":null,"errorMessage":"Error while reading \"%s\": %s","messagePattern":"Error while reading \"(.+?)\": (.+?)","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/conduit/parametertype/ConduitParameterType.php","lineNumber":67,"sourceCode":"\n  final public function getTypeName() {\n    return $this->getParameterTypeName();\n  }\n\n\n  final public function getFormatDescriptions() {\n    return $this->getParameterFormatDescriptions();\n  }\n\n\n  final public function getExamples() {\n    return $this->getParameterExamples();\n  }\n\n  protected function raiseValidationException(array $request, $key, $message) {\n    // TODO: Specialize this so we can give users more tailored messages from\n    // Conduit.\n    throw new Exception(\n      pht(\n        'Error while reading \"%s\": %s',\n        $key,\n        $message));\n  }\n\n\n  final public static function getAllTypes() {\n    return id(new PhutilClassMapQuery())\n      ->setAncestorClass(__CLASS__)\n      ->setUniqueMethod('getTypeName')\n      ->setSortMethod('getTypeName')\n      ->execute();\n  }\n\n\n  protected function getParameterExists(array $request, $key) {\n    return array_key_exists($key, $request);","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/conduit/parametertype/ConduitParameterType.php#L49-L85","documentation":"ConduitParameterType is the base class for all typed Conduit parameters (list<int>, map, string, ...). When a subclass fails to read a parameter because the supplied value has the wrong shape or contents, it calls raiseValidationException(), which throws with 'Error while reading \"<key>\": <detail>'. The key names the parameter path and the detail explains the expected format.","triggerScenarios":"Passing \"ids\": \"1,2,3\" (string) where the method declares a list (e.g. *.search constraints like phids/ids must be JSON arrays); passing an object where a list is expected; malformed inner values inside a container parameter.","commonSituations":"Hand-built parameter dictionaries against strongly typed *.search methods; scripts migrated from older loosely typed methods that accepted strings where new versions demand real JSON containers.","solutions":["Read the method's parameter documentation on its /conduit/ console page and match the container type exactly (array vs string vs map).","Fix the offending key named in the message, e.g. wrap comma-separated values into a JSON array.","Validate your payload against the method's documented format with a JSON schema check before sending."],"exampleFix":"// before\n{\"constraints\": {\"ids\": \"1,2,3\"}}\n// after\n{\"constraints\": {\"ids\": [1, 2, 3]}}","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"// PHP: assert container types match the method's documented parameters.\nfunction assert_list_param(array $params, $key) {\n  if (!isset($params[$key]) || !is_array($params[$key])) {\n    throw new InvalidArgumentException(sprintf(\n      'Parameter \"%s\" must be a JSON list, got %s.',\n      $key,\n      gettype($params[$key] ?? null)\n    ));\n  }\n  if ($params[$key] !== array_values($params[$key])) {\n    throw new InvalidArgumentException($key.' must be a list, not a map.');\n  }\n}","tryCatchPattern":"// From an HTTP/arc client: inspect the error_code in the response payload.\nif ($response['error_code'] !== null) {\n  // 'Error while reading \"<key>\": ...' names the exact offending parameter; fix and resend.\n}","preventionTips":["Copy parameter shapes from the method's console page (it documents list vs map vs scalar per key).","Check .search constraints with an array assertion before sending.","Encode with json_encode so containers stay containers instead of hand-written strings."],"tags":["conduit","parameters","validation","phabricator","php"],"backgroundTag":"parameter-validation-failed","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}