{"record":{"id":"1c1eda0df0fa0e0d","repo":"phacility/phabricator","slug":"storage-on-host-s-has-not-been-initialized-yet","errorCode":null,"errorMessage":"Storage on host \"%s\" has not been initialized yet. You must initialize storage before selectively applying patches.","messagePattern":"Storage on host \"(.+?)\" has not been initialized yet\\. You must initialize storage before selectively applying patches\\.","errorType":"exception","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/infrastructure/storage/management/workflow/PhabricatorStorageManagementWorkflow.php","lineNumber":955,"sourceCode":"      $applied = $api->getAppliedPatches();\n\n      $needs_init = ($applied === null);\n      if (!$needs_init) {\n        continue;\n      }\n\n      if ($is_dryrun) {\n        echo tsprintf(\n          \"%s\\n\",\n          pht(\n            'DRYRUN: Storage on host \"%s\" does not exist yet, so it '.\n            'would be created.',\n            $ref_key));\n        continue;\n      }\n\n      if ($apply_only) {\n        throw new PhutilArgumentUsageException(\n          pht(\n            'Storage on host \"%s\" has not been initialized yet. You must '.\n            'initialize storage before selectively applying patches.',\n            $ref_key));\n      }\n\n      // If we're initializing storage for the first time on any host, track\n      // it so that we can give the user a nicer experience during the\n      // subsequent adjustment phase.\n      $this->didInitialize = true;\n\n      $legacy = $api->getLegacyPatches($patches);\n      if ($legacy || $no_quickstart || $init_only) {\n        // If we have legacy patches, we can't quickstart.\n        $api->createDatabase('meta_data');\n        $api->createTable(\n          'meta_data',\n          'patch_status',","sourceCodeStart":937,"sourceCodeEnd":973,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementWorkflow.php#L937-L973","documentation":"`bin/storage upgrade --apply <patch>` ran against a host whose storage has never been initialized (its databases do not exist yet, so there is no patch state). Selectively applying one patch presupposes initialized storage, so the tool refuses; in a dry run the same situation only prints what would be created.","triggerScenarios":"Running `./bin/storage upgrade --apply <key>` on a fresh install or a newly added cluster host where the Phabricator databases do not exist yet ($apply_only set on an uninitialized host).","commonSituations":"Bringing a new cluster host online and jumping straight to --apply from a runbook; new developer machines; re-running an init procedure that was interrupted before the databases were created.","solutions":["Initialize first with a plain `./bin/storage upgrade` (no --apply); use --apply only for later single patches.","Confirm host state with `./bin/storage status` — uninitialized hosts are reported.","In bring-up scripts, gate any --apply step on the host showing as initialized."],"exampleFix":"# before (fresh install)\n./bin/storage upgrade --apply db.file.01\n\n# after\n./bin/storage upgrade                    # initialize all storage first\n./bin/storage upgrade --apply db.file.01  # later, for a single patch","handlingStrategy":"validation","validationCode":"if ! ./bin/storage status 2>/dev/null | grep -q 'Applied'; then\n  echo 'storage not initialized yet; run ./bin/storage upgrade first' >&2\n  exit 2\nfi\n./bin/storage upgrade --apply \"$KEY\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Sequence host bring-up: initialize with plain upgrade, then use --apply.","Run ./bin/storage status before any selective patch command on a new host."],"tags":["phabricator","bin-storage","upgrade","patch","initialization"],"backgroundTag":"storage-not-initialized","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}