garrytan/gstack · error · Error
Cannot create state directory ${config.stateDir}: a file exi
Error message
Cannot create state directory ${config.stateDir}: a file exists at that path What it means
Error "Cannot create state directory ${config.stateDir}: a file exists at that path" thrown in garrytan/gstack.
Source
Thrown at browse/src/config.ts:93
networkLog: path.join(stateDir, 'browse-network.log'),
dialogLog: path.join(stateDir, 'browse-dialog.log'),
auditLog: path.join(stateDir, 'browse-audit.jsonl'),
};
}
/**
* Create the .gstack/ state directory if it doesn't exist.
* Throws with a clear message on permission errors.
*/
export function ensureStateDir(config: BrowseConfig): void {
try {
mkdirSecure(config.stateDir);
} catch (err: any) {
if (err.code === 'EACCES') {
throw new Error(`Cannot create state directory ${config.stateDir}: permission denied`);
}
if (err.code === 'ENOTDIR') {
throw new Error(`Cannot create state directory ${config.stateDir}: a file exists at that path`);
}
throw err;
}
// Ensure .gstack/ is in the project's .gitignore
const gitignorePath = path.join(config.projectDir, '.gitignore');
try {
const content = fs.readFileSync(gitignorePath, 'utf-8');
if (!content.match(/^\.gstack\/?$/m)) {
const separator = content.endsWith('\n') ? '' : '\n';
fs.appendFileSync(gitignorePath, `${separator}.gstack/\n`);
}
} catch (err: any) {
if (err.code !== 'ENOENT') {
// Write warning to server log (visible even in daemon mode)
const logPath = path.join(config.stateDir, 'browse-server.log');
try {
fs.appendFileSync(logPath, `[${new Date().toISOString()}] Warning: could not update .gitignore at ${gitignorePath}: ${err.message}\n`);View on GitHub (pinned to 94993f7401)
When it happens
Trigger: Thrown at browse/src/config.ts:93 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of garrytan/gstack@94993f7401 (2026-08-12).
Data as JSON: /api/errors/48e24eb729869286.
Report an issue: GitHub.