{"record":{"id":"dab8c2317f4b9603","repo":"phacility/phabricator","slug":"unable-to-lock-repository-s-only-repositories","errorCode":null,"errorMessage":"Unable to lock repository \"%s\": only repositories that support clustering may be locked.","messagePattern":"Unable to lock repository \"(.+?)\": only repositories that support clustering may be locked\\.","errorType":"exception","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"error","filePath":"src/applications/repository/management/PhabricatorRepositoryManagementLockWorkflow.php","lineNumber":43,"sourceCode":"    $repositories = $this->loadRepositories($args, 'repositories');\n    if (!$repositories) {\n      throw new PhutilArgumentUsageException(\n        pht('Specify one or more repositories to lock.'));\n    }\n\n    foreach ($repositories as $repository) {\n      $display_name = $repository->getDisplayName();\n\n      if (!$repository->isHosted()) {\n        throw new PhutilArgumentUsageException(\n          pht(\n            'Unable to lock repository \"%s\": only hosted repositories may be '.\n            'locked.',\n            $display_name));\n      }\n\n      if (!$repository->supportsSynchronization()) {\n        throw new PhutilArgumentUsageException(\n          pht(\n            'Unable to lock repository \"%s\": only repositories that support '.\n            'clustering may be locked.',\n            $display_name));\n      }\n\n      if (!$repository->getAlmanacServicePHID()) {\n        throw new PhutilArgumentUsageException(\n          pht(\n            'Unable to lock repository \"%s\": only clustered repositories '.\n            'may be locked.',\n            $display_name));\n      }\n    }\n\n    $diffusion_phid = id(new PhabricatorDiffusionApplication())\n      ->getPHID();\n","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/repository/management/PhabricatorRepositoryManagementLockWorkflow.php#L25-L61","documentation":"Thrown by `bin/repository lock` when a target repository's `supportsSynchronization()` returns false — in Phabricator only Git and Mercurial implement cluster synchronization; Subversion repositories do not. It is the second pre-flight guard (after the hosted check), rejecting repositories whose VCS type cannot participate in clustered write locking.","triggerScenarios":"Running `./bin/repository lock` against an SVN repository; passing a wildcard list that includes the one SVN repo in an otherwise Git/Hg install.","commonSituations":"Legacy installations still hosting SVN attempt cluster lock procedures during maintenance windows; automation iterates all repositories without filtering by VCS type.","solutions":["Exclude the SVN repository from the lock target list.","For SVN maintenance, use other means (take the service down, disable pulls/pushes at the web layer) since cluster locking does not apply.","Long term, migrate the SVN repository to Git or Mercurial if cluster operations are required."],"exampleFix":"// before\n$ ./bin/repository lock R1 R3   # R3 is Subversion\n[1168] Unable to lock repository \"rR3\": only repositories that support clustering may be locked.\n\n// after\n$ ./bin/repository lock R1   # Git/Hg only","handlingStrategy":"validation","validationCode":"# Filter by VCS before locking (exclude SVN repos from the target list)\nfor r in R1 R3; do vcs=$(./bin/repository list --output json | jq -r --arg r \"$r\" '.[] | select(.callsign==$r) | .vcs'); [ \"$vcs\" = git ] || [ \"$vcs\" = hg ] && ./bin/repository lock \"$r\"; done","typeGuard":"function supports_cluster_lock(PhabricatorRepository $repository): bool {\n  return $repository->isGit() || $repository->isHg(); // supportsSynchronization() is true only for these\n}","tryCatchPattern":null,"preventionTips":["Keep SVN repositories out of cluster tooling target lists.","When automating across all repos, filter on VCS type first."],"tags":["phabricator","phorge","cli","locking","svn","vcs-type","precondition"],"backgroundTag":"unsupported-repository-type","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}