{"record":{"id":"d7ce78c8bb1fa8a9","repo":"google-gemini/gemini-cli","slug":"path-is-not-a-directory-absolutepath","errorCode":null,"errorMessage":"Path is not a directory: ${absolutePath}","messagePattern":"Path is not a directory: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/utils/workspaceContext.ts","lineNumber":145,"sourceCode":"      // 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  }\n\n  getInitialDirectories(): readonly string[] {\n    return Array.from(this.initialDirectories);\n  }\n","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/google-gemini/gemini-cli/blob/6a466a7e2fe2b1255752c1e74f69b31f0216084d/packages/core/src/utils/workspaceContext.ts#L127-L163","documentation":"resolveAndValidateDir found that the given directory path exists but is not a directory (statSync reports a file, symlink to a file, or other non-directory entry). The offending absolute path is embedded in the message; this is an input-validation guard for workspace directory configuration.","triggerScenarios":"Thrown at packages/core/src/utils/workspaceContext.ts:145 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Point the configuration at an actual directory path","Remove or replace the file occupying that path","Check for a mis-specified path that omits a directory component"],"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"}