{"record":{"id":"9551d02226041e15","repo":"phacility/phabricator","slug":"database-initialization-on-host-s-applied-no-pa","errorCode":null,"errorMessage":"Database initialization on host \"%s\" applied no patches!","messagePattern":"Database initialization on host \"(.+?)\" applied no patches!","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/infrastructure/storage/management/workflow/PhabricatorStorageManagementWorkflow.php","lineNumber":1011,"sourceCode":"    }\n\n    if ($init_only) {\n      echo pht('Storage initialized.').\"\\n\";\n      return 0;\n    }\n\n    $applied_map = array();\n    $state_map = array();\n    foreach ($api_map as $ref_key => $api) {\n      $applied = $api->getAppliedPatches();\n\n      // If we still have nothing applied, this is a dry run and we didn't\n      // actually initialize storage. Here, just do nothing.\n      if ($applied === null) {\n        if ($is_dryrun) {\n          continue;\n        } else {\n          throw new Exception(\n            pht(\n              'Database initialization on host \"%s\" applied no patches!',\n              $ref_key));\n        }\n      }\n\n      $applied = array_fuse($applied);\n      $state_map[$ref_key] = $applied;\n\n      if ($apply_only) {\n        if (isset($applied[$apply_only])) {\n          if (!$this->force && !$is_dryrun) {\n            echo phutil_console_wrap(\n              pht(\n                'Patch \"%s\" has already been applied on host \"%s\". Are you '.\n                'sure you want to apply it again? This may put your storage '.\n                'in a state that the upgrade scripts can not automatically '.\n                'manage.',","sourceCodeStart":993,"sourceCodeEnd":1029,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementWorkflow.php#L993-L1029","documentation":"After the initialization loop, a host still reports getAppliedPatches() === null — its patch status table is missing or unreadable — even though this was not a dry run. The tool expected initialization to leave patch state behind and throws rather than continue from unknown state.","triggerScenarios":"A host that went through init but has no readable patch status: an interrupted first run (Ctrl-C, crash), a DB account lacking privileges to create or write the patch status table, or someone dropping the metadata tables mid-run.","commonSituations":"Interrupted first bin/storage upgrade; MySQL user missing CREATE/INSERT on the target databases; concurrent re-initialization by another admin; earlier silent failures creating tables (max_allowed_packet, disk full).","solutions":["Check that the connecting DB account may create and write tables in the target databases (grant all on the Phabricator DBs).","Re-run `./bin/storage upgrade`; initialization is idempotent and will retry creating patch state.","Inspect the host with `./bin/storage status` and, if needed, look at its databases directly to see what was created.","Check the MySQL error log for the earlier failure that left initialization half-done."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  // bin/storage upgrade across hosts\n} catch (Exception $ex) {\n  // patch state missing on a host; inspect with ./bin/storage status before retrying\n  fwrite(STDERR, $ex->getMessage().\"\\n\");\n  exit(1);\n}","preventionTips":["Never interrupt the first bin/storage upgrade run; let it complete.","Verify DB grants (CREATE, INSERT) before initializing a new host.","After any failed init, reconcile state with ./bin/storage status before re-running."],"tags":["phabricator","bin-storage","upgrade","initialization","patch-status"],"backgroundTag":"patch-status-table-missing","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}