{"record":{"id":"138bf4972c1c9770","repo":"phacility/phabricator","slug":"you-can-not-cycle-keys-for-a-file-which-hasn-t-yet","errorCode":null,"errorMessage":"You can not cycle keys for a file which hasn't yet been saved.","messagePattern":"You can not cycle keys for a file which hasn't yet been saved\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/files/storage/PhabricatorFile.php","lineNumber":527,"sourceCode":"      $engine,\n      $data,\n      $params);\n\n    $this->setStorageHandle($new_handle);\n    $this->setIntegrityHash($integrity_hash);\n    $this->save();\n\n    $this->deleteFileDataIfUnused(\n      $engine,\n      $identifier,\n      $old_handle);\n\n    return $this;\n  }\n\n  public function cycleMasterStorageKey(PhabricatorFileStorageFormat $format) {\n    if (!$this->getID() || !$this->getStorageHandle()) {\n      throw new Exception(\n        pht(\"You can not cycle keys for a file which hasn't yet been saved.\"));\n    }\n\n    $properties = $format->cycleStorageProperties();\n    $this->setStorageProperties($properties);\n    $this->save();\n\n    return $this;\n  }\n\n  private function writeToEngine(\n    PhabricatorFileStorageEngine $engine,\n    $data,\n    array $params) {\n\n    $engine_class = get_class($engine);\n\n    $format = $this->newStorageFormat();","sourceCodeStart":509,"sourceCodeEnd":545,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/files/storage/PhabricatorFile.php#L509-L545","documentation":"Error \"You can not cycle keys for a file which hasn't yet been saved.\" thrown in phacility/phabricator.","triggerScenarios":"Thrown at src/applications/files/storage/PhabricatorFile.php:527 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}