{"record":{"id":"1cb46a83fc378b17","repo":"cline/cline","slug":"workspaceroot-must-be-an-existing-directory","errorCode":null,"errorMessage":"workspaceRoot must be an existing directory","messagePattern":"workspaceRoot must be an existing directory","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"sdk/packages/core/src/tasks/agenda-task-manager.ts","lineNumber":921,"sourceCode":"\t\t\t\tstatus: \"failed\",\n\t\t\t\tcurrentRunId: null,\n\t\t\t\terror: message,\n\t\t\t\tupdatedBy: TASK_MANAGER_ACTOR,\n\t\t\t}) ?? latestTask;\n\t\tthis.activeRuns.delete(task.taskId);\n\t\tthis.publish(\"task.run.failed\", finalTask, finalRun);\n\t}\n\n\tprivate ensureScope(\n\t\tscope: \"global\" | \"workspace\",\n\t\tworkspaceRoot?: string,\n\t): AgendaTaskSpecFileStore {\n\t\tconst root = optionalTrimmed(workspaceRoot);\n\t\tif (scope === \"workspace\" && !root) {\n\t\t\tthrow new Error(\"workspaceRoot is required for workspace task scope\");\n\t\t}\n\t\tif (scope === \"workspace\" && !isExistingDirectory(root)) {\n\t\t\tthrow new Error(\"workspaceRoot must be an existing directory\");\n\t\t}\n\t\tconst key = scope === \"global\" ? \"global\" : `workspace:${root}`;\n\t\tconst existing = this.scopes.get(key);\n\t\tif (existing) return existing.store;\n\t\tconst store = new AgendaTaskSpecFileStore({\n\t\t\tscope,\n\t\t\tworkspaceRoot: root,\n\t\t\ttaskSpecsDir: scope === \"global\" ? this.globalSpecsDir : undefined,\n\t\t});\n\t\tconst watched: WatchedScope = { store };\n\t\tlet cacheScope = true;\n\t\ttry {\n\t\t\tstore.ensureSpecsDir();\n\t\t\tconst watchRoot = this.watchFiles\n\t\t\t\t? this.resolveWatchRoot(store.specsDir)\n\t\t\t\t: undefined;\n\t\t\tif (watchRoot !== undefined) {\n\t\t\t\twatched.watcher = watch(watchRoot, (_event, filename) => {","sourceCodeStart":903,"sourceCodeEnd":939,"githubUrl":"https://github.com/cline/cline/blob/491b30b806fdb8c93513f821f2b87d63a61542f5/sdk/packages/core/src/tasks/agenda-task-manager.ts#L903-L939","documentation":"Error \"workspaceRoot must be an existing directory\" thrown in cline/cline.","triggerScenarios":"Thrown at sdk/packages/core/src/tasks/agenda-task-manager.ts:921 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"}