{"record":{"id":"28b284fc2cc88f74","repo":"phacility/phabricator","slug":"err-need-diff","errorCode":"ERR-NEED-DIFF","errorMessage":"ERR-NEED-DIFF","messagePattern":"ERR-NEED-DIFF","errorType":"error_code","errorClass":"ConduitException","httpStatus":null,"severity":"error","filePath":"src/applications/differential/conduit/DifferentialCreateInlineConduitAPIMethod.php","lineNumber":78,"sourceCode":"      if (!$did) { // did not!\n        $diff = $revision->loadActiveDiff();\n        $did = $diff->getID();\n      } else { // did too!\n        $diff = id(new DifferentialDiff())->load($did);\n        if (!$diff || $diff->getRevisionID() != $rid) {\n          throw new ConduitException('ERR-BAD-DIFF');\n        }\n      }\n    } else if ($did) {\n      // Given only a diff, find the parent revision.\n      $diff = id(new DifferentialDiff())->load($did);\n      if (!$diff) {\n        throw new ConduitException('ERR-BAD-DIFF');\n      }\n      $rid = $diff->getRevisionID();\n    } else {\n      // Given neither, bail.\n      throw new ConduitException('ERR-NEED-DIFF');\n    }\n\n    $file = $request->getValue('filePath');\n    if (!$file) {\n      throw new ConduitException('ERR-NEED-FILE');\n    }\n    $changes = id(new DifferentialChangeset())->loadAllWhere(\n      'diffID = %d',\n      $did);\n    $cid = null;\n    foreach ($changes as $id => $change) {\n      if ($file == $change->getFilename()) {\n        $cid = $id;\n      }\n    }\n    if ($cid == null) {\n      throw new ConduitException('ERR-BAD-FILE');\n    }","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/differential/conduit/DifferentialCreateInlineConduitAPIMethod.php#L60-L96","documentation":"Thrown by differential.createinline when neither revisionID nor diffID is supplied. The method needs at least one of the two to resolve the revision and diff that the inline comment attaches to; with both falsy it bails immediately with ConduitException('ERR-NEED-DIFF').","triggerScenarios":"Calling differential.createinline with neither revisionID nor diffID, or with both set to 0/null/empty string (e.g. a wrapper that read missing values from a config file and passed them through).","commonSituations":"Batch tools whose input rows sometimes lack the IDs; environment-specific configuration where the revision/diff variables are never populated; refactors that renamed the keys.","solutions":["Always supply at least one of revisionID or diffID","Validate the parameters before the call and skip rows with no IDs, logging them for follow-up","Prefer revisionID so the server resolves the active diff itself","Distinguish this client error from ERR-BAD-DIFF in your handling - retrying will not help"],"exampleFix":"// before\n$params = array(\n  'filePath' => 'src/app.php',\n  'content' => 'Note.',\n);\n\n// after\n$params = array(\n  'revisionID' => 789,\n  'filePath' => 'src/app.php',\n  'content' => 'Note.',\n);","handlingStrategy":"validation","validationCode":"if (empty($params['revisionID']) && empty($params['diffID'])) {\n  throw new InvalidArgumentException(\n    'createinline requires revisionID or diffID');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Require at least one of revisionID/diffID in the wrapper's own contract","Skip and log input rows lacking both IDs","Prefer revisionID so the server resolves the active diff"],"tags":["phabricator","conduit","differential","inline-comment","missing-parameter"],"backgroundTag":"missing-required-parameter","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}