{"record":{"id":"d56bb1b124128eed","repo":"microsoft/playwright","slug":"an-active-lockfile-is-found-at-lockfilepath","errorCode":null,"errorMessage":"An active lockfile is found at:\n\n  ${lockfilePath}\n\nEither:\n- wait a few minutes if other Playwright is installing browsers in parallel\n- remove lock manually with:\n\n    ${rmCommand} ${lockfilePath}\n\n<3 Playwright Team","messagePattern":"An active lockfile is found at:\n\n  (.+?)\n\nEither:\n- wait a few minutes if other Playwright is installing browsers in parallel\n- remove lock manually with:\n\n    (.+?) (.+?)\n\n<3 Playwright Team","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/server/registry/index.ts","lineNumber":994,"sourceCode":"            `requires *removal* of a current installation first.`,\n            ``,\n            `To *uninstall* current version and re-install latest \"${executable.name}\":`,\n            ``,\n            `- Close all running instances of \"${executable.name}\", if any`,\n            `- Use \"--force\" to install browser:`,\n            ``,\n            `    ${command}`,\n            ``,\n            `<3 Playwright Team`,\n          ].join('\\n'), 1) + '\\n\\n');\n          return;\n        }\n        await executable._install(!!options?.force);\n      }\n    } catch (e) {\n      if (e.code === 'ELOCKED') {\n        const rmCommand = process.platform === 'win32' ? 'rm -R' : 'rm -rf';\n        throw new Error('\\n' + wrapInASCIIBox([\n          `An active lockfile is found at:`,\n          ``,\n          `  ${lockfilePath}`,\n          ``,\n          `Either:`,\n          `- wait a few minutes if other Playwright is installing browsers in parallel`,\n          `- remove lock manually with:`,\n          ``,\n          `    ${rmCommand} ${lockfilePath}`,\n          ``,\n          `<3 Playwright Team`,\n        ].join('\\n'), 1));\n      } else {\n        throw e;\n      }\n    } finally {\n      if (releaseLock)\n        await releaseLock();","sourceCodeStart":976,"sourceCodeEnd":1012,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/server/registry/index.ts#L976-L1012","documentation":"Thrown from the catch block of Registry.install when the lock acquisition fails with error code ELOCKED — the proper-lockfile library exhausted all 20 retries over ~10 minutes without obtaining the lock. The boxed message tells the user another Playwright process holds the lock and gives the manual removal command for the platform.","triggerScenarios":"A prior 'playwright install' crashed without releasing the __dirlock, or a long-running concurrent install still holds it; subsequent installs retry for 10 minutes then surface this error.","commonSituations":"CI job that was killed mid-install leaving a stale lock; multiple pipeline stages installing browsers into the same PLAYWRIGHT_BROWSERS_PATH simultaneously; local dev interrupted an install with Ctrl-C.","solutions":["Run the rm command printed in the message ('rm -rf <path>' on macOS/Linux, 'rm -R <path>' on Windows) then re-run the install.","Wait and retry if another install is legitimately running.","Isolate installs with a unique PLAYWRIGHT_BROWSERS_PATH per concurrent job.","Add a lock-cleanup step at the start of CI: remove the __dirlock file before installing."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"import { existsSync, rmSync } from 'fs';\nimport { join } from 'path';\n\n// Remove a stale lock before installing\nconst lock = join(process.env.PLAYWRIGHT_BROWSERS_PATH || '', 'ms-playwright', '__dirlock');\nif (existsSync(lock)) rmSync(lock, { recursive: true, force: true });","typeGuard":null,"tryCatchPattern":"try {\n  await registry.install(executables);\n} catch (e) {\n  if (e.code === 'ELOCKED' || /active lockfile is found/.test(e.message)) {\n    // wait briefly, remove stale lock, retry once\n    rmSync(lockfilePath, { recursive: true, force: true });\n    await registry.install(executables);\n  } else throw e;\n}","preventionTips":["Remove the __dirlock at the start of CI steps where a prior install may have been killed.","Use a unique PLAYWRIGHT_BROWSERS_PATH per concurrent job to avoid contention.","Do not run two 'playwright install' commands against the same registry directory in parallel."],"tags":["install","lockfile","concurrency","registry","ci"],"backgroundTag":null,"analyzedSha":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}