{"record":{"id":"41cb6fe6d7b413e5","repo":"phacility/phabricator","slug":"storage-patch-s-specifies-a-phase-value-s-41cb6f","errorCode":null,"errorMessage":"Storage patch \"%s\" specifies a \"@phase\" value (\"%s\"), but it already has a specified phase (\"%s\"). Patches may not specify multiple phases.","messagePattern":"Storage patch \"(.+?)\" specifies a \"@phase\" value \\(\"(.+?)\"\\), but it already has a specified phase \\(\"(.+?)\"\\)\\. Patches may not specify multiple phases\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/infrastructure/storage/patch/PhabricatorSQLPatchList.php","lineNumber":312,"sourceCode":"                    'Storage patch \"%s\" specifies a \"@phase\" attribute with '.\n                    'no phase value. Phase attributes must specify a value, '.\n                    'like \"@phase default\".',\n                    $patch_name));\n              }\n\n              if (!isset($phase_map[$phase_name])) {\n                throw new Exception(\n                  pht(\n                    'Storage patch \"%s\" specifies a \"@phase\" value (\"%s\"), '.\n                    'but this is not a recognized phase. Valid phases '.\n                    'are: %s.',\n                    $patch_name,\n                    $phase_name,\n                    implode(', ', $phase_list)));\n              }\n\n              if (isset($attributes['phase'])) {\n                throw new Exception(\n                  pht(\n                    'Storage patch \"%s\" specifies a \"@phase\" value (\"%s\"), '.\n                    'but it already has a specified phase (\"%s\"). Patches '.\n                    'may not specify multiple phases.',\n                    $patch_name,\n                    $phase_name,\n                    $attributes['phase']));\n              }\n\n              $attributes[$attr_key] = $phase_name;\n              break;\n            default:\n              throw new Exception(\n                pht(\n                  'Storage patch \"%s\" specifies attribute \"%s\", but this '.\n                  'attribute is unknown.',\n                  $patch_name,\n                  $attr_key));","sourceCodeStart":294,"sourceCodeEnd":330,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/infrastructure/storage/patch/PhabricatorSQLPatchList.php#L294-L330","documentation":"A PHP patch file may declare its phase exactly once. The header parser remembers the phase after the first '// @phase' line; if a second, different '@phase' attribute appears later in the header block, the loader throws because a single patch cannot execute in two phases.","triggerScenarios":"The leading comment block of a .php patch contains two '// @phase ...' lines — e.g. a merged patch file where both contributors added a phase annotation, or an edited header where the old line was left in place.","commonSituations":"Merge conflicts in patch headers resolved by keeping both lines; editing an existing '@phase' line by duplicating it and editing the copy instead of the original.","solutions":["Keep only one '// @phase' line in the header block and delete the other.","Verify the surviving value is the intended phase ('default' or 'worker').","Re-run 'bin/storage status' to confirm the file parses."],"exampleFix":"// before\n<?php\n// @phase worker\n// @phase default\n// Migrates job tables.\n\n// after\n<?php\n// @phase worker\n// Migrates job tables.","handlingStrategy":"validation","validationCode":"// A header block must contain at most one '@phase' line:\n$lines = file($patch_path);\n$phase_lines = preg_grep('/^\\s*\\/\\/\\s*@phase\\s+\\S+/', $lines);\nif (count($phase_lines) > 1) {\n  throw new Exception('Patch header declares more than one phase');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Edit the existing '@phase' line in place; never add a second one.","After resolving merge conflicts in patch headers, grep the file for duplicate '@phase' lines."],"tags":["phabricator","database-migration","phases","file-header","duplicate-attribute"],"backgroundTag":"database-migration-validation","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}