{"record":{"id":"5efae7ae5de5ae7f","repo":"google-gemini/gemini-cli","slug":"directory-does-not-exist-absolutepath","errorCode":null,"errorMessage":"Directory does not exist: ${absolutePath}","messagePattern":"Directory does not exist: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/utils/workspaceContext.ts","lineNumber":140,"sourceCode":"    try {\n      // Check if it exists\n      if (!fs.existsSync(pathToAdd)) {\n        return;\n      }\n      // Resolve symlinks and SFNs canonically\n      const resolved = resolveToRealPath(\n        path.resolve(this.targetDir, pathToAdd),\n      );\n      this.readOnlyPaths.add(resolved);\n    } catch (e) {\n      debugLogger.warn(`Failed to add read-only path ${pathToAdd}:`, e);\n    }\n  }\n\n  private resolveAndValidateDir(directory: string): string {\n    const absolutePath = path.resolve(this.targetDir, directory);\n\n    if (!fs.existsSync(absolutePath)) {\n      throw new Error(`Directory does not exist: ${absolutePath}`);\n    }\n    const stats = fs.statSync(absolutePath);\n    if (!stats.isDirectory()) {\n      throw new Error(`Path is not a directory: ${absolutePath}`);\n    }\n\n    // Resolve workspace directory canonically (supporting Windows SFNs)\n    return resolveToRealPath(absolutePath);\n  }\n\n  /**\n   * Gets a copy of all workspace directories.\n   * @returns Array of absolute directory paths\n   */\n  getDirectories(): readonly string[] {\n    return Array.from(this.directories);\n  }","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/google-gemini/gemini-cli/blob/6a466a7e2fe2b1255752c1e74f69b31f0216084d/packages/core/src/utils/workspaceContext.ts#L122-L158","documentation":"resolveAndValidateDir was given a workspace directory configuration path that does not exist on disk (existsSync returned false). The expected absolute path is embedded in the message; this fires during directory setup before any stat/type check is made.","triggerScenarios":"Thrown at packages/core/src/utils/workspaceContext.ts:140 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Create the directory or fix the typo in the configured path","Verify the relative directory is resolved against the intended targetDir","Remove stale directory entries from configuration"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6a466a7e2fe2b1255752c1e74f69b31f0216084d","analyzedAt":"2026-09-16T18:14:43.978Z","contentChangedAt":"2026-09-16T18:14:43.978Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}