google-gemini/gemini-cli · error · Error
Workspace path ${resolvedPath} does not exist
Error message
Workspace path ${resolvedPath} does not exist What it means
Thrown by validateWorkspacePath after fs.stat fails with ENOENT in non-test mode. The path passed the allowed-root check but does not exist on disk; in test environments the directory would be auto-created (mkdir recursive), but production refuses to silently create workspaces.
Source
Thrown at packages/a2a-server/src/config/config.ts:488
`Workspace path ${resolvedPath} is outside the allowed root directory`,
);
}
let stats: fs.Stats;
try {
stats = await fs.promises.stat(resolvedPath);
} catch (err: unknown) {
if (
err &&
typeof err === 'object' &&
'code' in err &&
err.code === 'ENOENT'
) {
if (isTestEnv) {
await fs.promises.mkdir(resolvedPath, { recursive: true });
stats = await fs.promises.stat(resolvedPath);
} else {
throw new Error(`Workspace path ${resolvedPath} does not exist`);
}
} else {
throw err;
}
}
if (!stats.isDirectory()) {
throw new Error(`Workspace path ${resolvedPath} is not a directory`);
}
return resolvedPath;
} catch (e) {
logger.error(`[CoderAgentExecutor] Error resolving workspace path: ${e}`);
throw e;
}
}
export async function loadEnvironment(View on GitHub (pinned to 5024443c72)
Solutions
- Create the directory before starting the server: mkdir -p $CODER_AGENT_WORKSPACE_PATH.
- Verify the path is correct (no typos, correct absolute path).
- If the volume mount is async, add a readiness check that the dir exists before launching the agent.
- For ephemeral workspaces, set NODE_ENV=test only in truly throwaway environments (it auto-creates).
Example fix
# before export CODER_AGENT_WORKSPACE_PATH=/srv/workspaces/agent-1 # throws: does not exist # after mkdir -p /srv/workspaces/agent-1 export CODER_AGENT_WORKSPACE_PATH=/srv/workspaces/agent-1
Defensive patterns
Strategy: validation
Validate before calling
import fs from 'node:fs/promises';
async function ensureWorkspaceExists(p: string) {
try { await fs.access(p); }
catch { throw new Error(`Workspace ${p} does not exist. Create it before starting the agent.`); }
}
await ensureWorkspaceExists(process.env.CODER_AGENT_WORKSPACE_PATH!); Prevention
- Add a startup readiness check that the workspace dir exists before binding the server.
- Provision the directory in your orchestrator (k8s emptyDir, Docker volume) before the agent starts.
- Double-check the path for typos.
- Only rely on the test-env auto-mkdir in truly ephemeral test runs.
When it happens
Trigger: CODER_AGENT_WORKSPACE_PATH points at a directory that has not been created yet; typo in the path; the directory was deleted between runs; mount point not yet attached in a container.
Common situations: Fresh deploy referencing a workspace dir that the orchestrator hasn't provisioned; typo like /home/user/projcts; container start order where the volume mount lags the server boot.
Related errors
- Workspace path ${resolvedPath} is not a directory
- Workspace path ${resolvedPath} is outside the allowed root d
- [${logPrefix}] Unable to set GeneratorConfig. Please provide
- tar.c command failed to create ${tmpArchiveFile}
- The path "${trimmedPath}" is not a directory.
AI-assisted analysis of google-gemini/gemini-cli@5024443c72 (2026-08-12).
Data as JSON: /api/errors/444b89bfc70550fc.
Report an issue: GitHub.