n8n-io/n8n · warning · Error
Access denied: "${excludedSegment}" is excluded from filesys
Error message
Access denied: "${excludedSegment}" is excluded from filesystem reads What it means
Thrown by assertNoExcludedSegments() (called from resolveReadablePath) when the resolved path contains a directory segment matching an excluded name: node_modules, .git, dist, build, coverage, __pycache__, .venv, venv, .vscode, .idea, .next, .nuxt, .cache, .turbo, .output, .svelte-kit. The comparison is case-insensitive. resolveReadablePath runs this check on both the logical and real (symlink-resolved) paths, so symlinks into excluded directories are also caught.
Source
Thrown at packages/@n8n/computer-use/src/tools/filesystem/fs-utils.ts:146
'.prettierrc.json',
'.editorconfig',
'.gitignore',
'.dockerignore',
'.nvmrc',
'.node-version',
'.npmrc',
'.babelrc',
'.browserslistrc',
]);
return allowed.has(name);
}
export function assertNoExcludedSegments(absolutePath: string, basePath: string): void {
const relativePath = path.relative(path.resolve(basePath), path.resolve(absolutePath));
const segments = relativePath.split(path.sep).filter(Boolean);
const excludedSegment = segments.find(isExcludedDirName);
if (excludedSegment) {
throw new Error(`Access denied: "${excludedSegment}" is excluded from filesystem reads`);
}
}
export function isExcludedDirName(segment: string): boolean {
return NORMALIZED_EXCLUDED_DIRS.has(segment.toLowerCase());
}
export function isLikelyBinaryContent(buffer: Buffer): boolean {
if (buffer.length === 0) return false;
if (buffer.includes(0)) return true;
try {
utf8Decoder.decode(buffer);
} catch {
return true;
}
const checkSlice = buffer.subarray(0, Math.min(BINARY_CHECK_SIZE, buffer.length));View on GitHub (pinned to 5ac6606e81)
Solutions
- Use the library's public type definitions or documentation instead of reading source in node_modules
- Copy the specific needed file into the base directory if read access is essential
- Check the EXCLUDED_DIRS set in fs-utils.ts to see which directory names are blocked
- Use search_files with a pattern that excludes the blocked directory
Defensive patterns
Strategy: validation
Validate before calling
import { EXCLUDED_DIRS } from './fs-utils';
function containsExcludedSegment(relativePath: string): string | null {
const excluded = new Set([...EXCLUDED_DIRS].map(d => d.toLowerCase()));
const segment = relativePath.split('/').find(s => excluded.has(s.toLowerCase()));
return segment ?? null;
}
// Before calling read_file or search_files:
const blocked = containsExcludedSegment(filePath);
if (blocked) {
throw new Error(`Cannot read inside excluded directory: ${blocked}`);
} Type guard
function isExcludedSegmentError(e: unknown): boolean {
return e instanceof Error && e.message.startsWith('Access denied:') && e.message.includes('is excluded from filesystem reads');
} Prevention
- Check the EXCLUDED_DIRS set in fs-utils.ts to know which directories are blocked
- Avoid paths through node_modules, .git, dist, build, and other dependency/VCS/build dirs
- Use the library's type definitions or documentation instead of reading source in excluded dirs
When it happens
Trigger: A read_file or search_files call targets a path inside node_modules/, .git/, dist/, or any other excluded directory. Also fires if a symlink resolves into an excluded directory.
Common situations: Agent tries to read a library source file in node_modules to understand an API, or tries to read .git internals, or accesses a build output in dist/.
Understand the failure class
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
Related errors
- Pattern "${pattern}" escapes the base directory
- Invalid skill at ${sourceDirectory}: ${errors.join('; ')}
- File too large: ${stat.size} bytes (max ${MAX_FILE_SIZE} byt
- oldString not found in file: ${filePath}
- Path "${relativePath}" escapes the base directory
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/62f0c180523c0729.
Report an issue: GitHub.