angular/angular-cli · warning
Failed to verify workspace path '${workspacePath}': ${e inst
Error message
Failed to verify workspace path '${workspacePath}': ${e instanceof Error ? e.message : e}. Falling back to the bundled guide. What it means
getVersionSpecificBestPractices verifies that the requested workspace path is allowed (via isAllowedWorkspacePath against the MCP server roots) before reading version-specific Angular best-practices docs. If the verification throws, the tool warns and returns undefined so the caller falls back to the bundled guide.
Source
Thrown at packages/angular/cli/src/commands/mcp/tools/best-practices.ts:104
* ```
*
* @param workspacePath The absolute path to the user's `angular.json` file.
* @param logger The MCP tool context logger for reporting warnings.
* @param server The MCP server context, used to enforce the client's declared roots.
* @returns A promise that resolves to an object containing the guide's content and source,
* or `undefined` if the guide could not be resolved.
*/
async function getVersionSpecificBestPractices(
workspacePath: string,
logger: McpToolContext['logger'],
server: McpToolContext['server'],
): Promise<{ content: string; source: string } | undefined> {
if (server) {
let isAllowed: boolean;
try {
isAllowed = await isAllowedWorkspacePath(server, workspacePath);
} catch (e) {
logger.warn(
`Failed to verify workspace path '${workspacePath}': ` +
`${e instanceof Error ? e.message : e}. Falling back to the bundled guide.`,
);
return undefined;
}
if (!isAllowed) {
throw new Error(
`Workspace path is outside the allowed MCP roots: ${workspacePath}. ` +
"You can use 'list_projects' to find available workspaces.",
);
}
}
// 1. Resolve the path to package.json
let pkgJsonPath: string;
try {View on GitHub (pinned to bb72145f9a)
Solutions
- Ensure the requested workspacePath is within the MCP server's configured roots.
- Verify MCP roots were initialized successfully on connection (watch for the roots warnings).
- Retry the tool call; the bundled best-practices guide is used as fallback meanwhile.
Defensive patterns
Strategy: fallback
Validate before calling
// Pre-check the path is under an allowed root before calling the tool:
const allowed = roots.some((root) => resolve(workspacePath).startsWith(resolve(root) + path.sep));
if (!allowed) console.warn('workspacePath is outside MCP roots; bundled guide will be used.'); Try / catch
try {
const guide = await getVersionSpecificBestPractices(server, workspacePath, logger, version);
} catch {
const guide = getBundledBestPractices(); // fallback
} Prevention
- Request best practices only for paths inside the MCP server's roots.
- Ensure roots initialized successfully before calling tools.
- Accept the bundled-guide fallback as the designed safety net.
When it happens
Trigger: The MCP client requests version-specific best practices for a workspacePath while isAllowedWorkspacePath throws — e.g. the server connection is broken, roots are unavailable, or path checks fail unexpectedly.
Common situations: MCP roots not initialized (see roots-init warning); client requesting paths outside allowed roots; transient server/client communication errors during tool calls.
Related errors
- Detected a potential path traversal attempt in '${pkgJsonPat
- Workspace path is outside the allowed MCP roots: ${workspace
- Workspace path is outside the allowed MCP roots: ${workspace
- The current directory resolves to a workspace outside the al
- Could not resolve '@angular/core/package.json' from '${works
AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30).
Data as JSON: /api/errors/41b600a2540de531.
Report an issue: GitHub.