google-gemini/gemini-cli · error · Error
Path is not a directory
Error message
Path is not a directory: ${absolutePath} What it means
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.
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
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/core/src/utils/workspaceContext.ts:145 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of google-gemini/gemini-cli@6a466a7e2f (2026-09-16).
Data as JSON: /api/errors/d7ce78c8bb1fa8a9.
Report an issue: GitHub.
Appendix: source
Thrown at packages/core/src/utils/workspaceContext.ts:145
// Resolve symlinks and SFNs canonically
const resolved = resolveToRealPath(
path.resolve(this.targetDir, pathToAdd),
);
this.readOnlyPaths.add(resolved);
} catch (e) {
debugLogger.warn(`Failed to add read-only path ${pathToAdd}:`, e);
}
}
private resolveAndValidateDir(directory: string): string {
const absolutePath = path.resolve(this.targetDir, directory);
if (!fs.existsSync(absolutePath)) {
throw new Error(`Directory does not exist: ${absolutePath}`);
}
const stats = fs.statSync(absolutePath);
if (!stats.isDirectory()) {
throw new Error(`Path is not a directory: ${absolutePath}`);
}
// Resolve workspace directory canonically (supporting Windows SFNs)
return resolveToRealPath(absolutePath);
}
/**
* Gets a copy of all workspace directories.
* @returns Array of absolute directory paths
*/
getDirectories(): readonly string[] {
return Array.from(this.directories);
}
getInitialDirectories(): readonly string[] {
return Array.from(this.initialDirectories);
}
View on GitHub (pinned to 6a466a7e2f)