{"record":{"id":"6bfd13f96e77f446","repo":"phacility/phabricator","slug":"field-slug-must-be-non-empty-6bfd13","errorCode":null,"errorMessage":"Field \"slug\" must be non-empty.","messagePattern":"Field \"slug\" must be non-empty\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/phriction/conduit/PhrictionEditConduitAPIMethod.php","lineNumber":29,"sourceCode":"  }\n\n  protected function defineParamTypes() {\n    return array(\n      'slug'          => 'required string',\n      'title'         => 'optional string',\n      'content'       => 'optional string',\n      'description'   => 'optional string',\n    );\n  }\n\n  protected function defineReturnType() {\n    return 'nonempty dict';\n  }\n\n  protected function execute(ConduitAPIRequest $request) {\n    $slug = $request->getValue('slug');\n    if ($slug === null || !strlen($slug)) {\n      throw new Exception(pht('Field \"slug\" must be non-empty.'));\n    }\n\n    $doc = id(new PhrictionDocumentQuery())\n      ->setViewer($request->getUser())\n      ->withSlugs(array(PhabricatorSlug::normalize($slug)))\n      ->needContent(true)\n      ->requireCapabilities(\n        array(\n          PhabricatorPolicyCapability::CAN_VIEW,\n          PhabricatorPolicyCapability::CAN_EDIT,\n        ))\n      ->executeOne();\n    if (!$doc) {\n      throw new Exception(pht('No such document.'));\n    }\n\n    $xactions = array();\n    if ($request->getValue('title')) {","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/phriction/conduit/PhrictionEditConduitAPIMethod.php#L11-L47","documentation":"The phriction.edit Conduit method identifies the target document solely by the slug field; execute() rejects a null or zero-length slug before the document query runs. It is a plain Exception, so Conduit clients receive a generic error rather than a structured code.","triggerScenarios":"Calling conduit method phriction.edit with slug omitted, null, or the empty string, so the lookup key for the document to edit is missing.","commonSituations":"Edit automation where the slug comes from an upstream field that is sometimes blank; parameter typos like 'path' instead of 'slug'; template code copy-pasted with the slug line removed.","solutions":["Pass the non-empty document slug in the call parameters","Validate the parameter map before invoking phriction.edit when the caller cannot guarantee it","Use phriction.info with the same slug first to confirm the document resolves"],"exampleFix":"// before\n$params = array('content' => $new_content);\n$client->callMethodSynchronous('phriction.edit', $params);\n\n// after\n$params = array(\n  'slug' => '/runbook/deploy',\n  'content' => $new_content,\n);\n$client->callMethodSynchronous('phriction.edit', $params);","handlingStrategy":"validation","validationCode":"$slug = (string)idx($params, 'slug', '');\nif ($slug === '') {\n  throw new InvalidArgumentException('phriction.edit: slug must be non-empty');\n}\n$result = $client->callMethodSynchronous('phriction.edit', $params);","typeGuard":null,"tryCatchPattern":"try {\n  $result = $client->callMethodSynchronous('phriction.edit', $params);\n} catch (Exception $ex) {\n  if (strpos($ex->getMessage(), 'must be non-empty') !== false) {\n    // fix the caller: the edit target was never specified\n  }\n}","preventionTips":["Validate the slug parameter wherever edit automation accepts external input","Assert non-empty parameters in shared conduit helper wrappers","Log the full parameter map on failure to locate the blank field"],"tags":["phabricator","phriction","conduit","slug","input-validation"],"backgroundTag":"required-field-empty","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}