{"record":{"id":"3c97d039378c39af","repo":"cline/cline","slug":"timed-out-waiting-for-hub-label-lock-lockdir","errorCode":null,"errorMessage":"Timed out waiting for hub ${label} lock ${lockDir}","messagePattern":"Timed out waiting for hub (.+?) lock (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdk/packages/core/src/hub/discovery/index.ts","lineNumber":501,"sourceCode":"\t\t\tconst record = await readHubLockRecord(lockDir);\n\t\t\tif (!record) {\n\t\t\t\t// The winner creates the directory before it can publish owner.json.\n\t\t\t\t// Do not steal that initialization window. A genuinely abandoned\n\t\t\t\t// empty lock is reclaimed only after the bounded wait.\n\t\t\t\tif (Date.now() >= deadline) {\n\t\t\t\t\tawait removeHubLock(lockDir);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tawait sleep(HUB_STARTUP_LOCK_POLL_MS);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst lockAge = Date.now() - Date.parse(record.acquiredAt);\n\t\t\tif (!isPidAlive(record.pid) || lockAge > HUB_STARTUP_LOCK_MAX_AGE_MS) {\n\t\t\t\tawait removeHubLock(lockDir);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (Date.now() >= deadline) {\n\t\t\t\tthrow new Error(`Timed out waiting for hub ${label} lock ${lockDir}`);\n\t\t\t}\n\t\t\tawait sleep(HUB_STARTUP_LOCK_POLL_MS);\n\t\t\tcontinue;\n\t\t}\n\n\t\ttry {\n\t\t\tawait writeFile(\n\t\t\t\tjoin(lockDir, \"owner.json\"),\n\t\t\t\t`${JSON.stringify(\n\t\t\t\t\t{ pid: process.pid, acquiredAt: new Date().toISOString() },\n\t\t\t\t\tnull,\n\t\t\t\t\t2,\n\t\t\t\t)}\\n`,\n\t\t\t\t\"utf8\",\n\t\t\t);\n\t\t\treturn await callback();\n\t\t} finally {\n\t\t\tawait removeHubLock(lockDir);","sourceCodeStart":483,"sourceCodeEnd":519,"githubUrl":"https://github.com/cline/cline/blob/491b30b806fdb8c93513f821f2b87d63a61542f5/sdk/packages/core/src/hub/discovery/index.ts#L483-L519","documentation":"Error \"Timed out waiting for hub ${label} lock ${lockDir}\" thrown in cline/cline.","triggerScenarios":"Thrown at sdk/packages/core/src/hub/discovery/index.ts:501 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"491b30b806fdb8c93513f821f2b87d63a61542f5","analyzedAt":"2026-08-25T13:45:22.367Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}