n8n-io/n8n · error · InternalServerError
Internal Server Error
Error message
Internal Server Error
What it means
InternalServerError (HTTP 500) thrown at folder.controller.ts:75 as the catch-all in `createFolder` for any non-`FolderNotFoundError` exception from `folderService.createFolder`. The message defaults to 'Internal Server Error' (the original error is attached as `cause` via `InternalServerError(undefined, e)`). Indicates an unexpected service-layer failure (DB, constraint, transaction).
Source
Thrown at packages/cli/src/controllers/folder.controller.ts:75
@Post('/')
@ProjectScope('folder:create')
@Licensed('feat:folders')
async createFolder(
req: AuthenticatedRequest<{ projectId: string }>,
_res: Response,
@Body payload: CreateFolderDto,
) {
const { projectId } = req.params;
try {
const folder = await this.folderService.createFolder(payload, projectId);
return folder;
} catch (e) {
if (e instanceof FolderNotFoundError) {
throw new NotFoundError(e.message);
}
throw new InternalServerError(undefined, e);
}
}
@Get('/:folderId/tree')
@ProjectScope('folder:read')
@Licensed('feat:folders')
async getFolderTree(
req: AuthenticatedRequest<{ projectId: string; folderId: string }>,
_res: Response,
) {
const { projectId, folderId } = req.params;
try {
const tree = await this.folderService.getFolderTree(folderId, projectId);
return tree;
} catch (e) {
if (e instanceof FolderNotFoundError) {
throw new NotFoundError(e.message);View on GitHub (pinned to 5ac6606e81)
Solutions
- Inspect server logs for the original `cause` chained under the `InternalServerError`.
- If duplicate-name: choose a different folder name or remove the conflicting folder.
- If DB: verify DB connectivity and that the `folder` / `folder_relationship` tables are intact.
- Reproduce with verbose logging (`N8N_LOG_LEVEL=debug`) to capture the wrapped error.
Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-check for the most common cause: duplicate name under same parent
async function nameIsUnique(svc: FolderService, projectId: string, name: string, parentId?: string) {
const tree = await svc.getFolderTree(parentId ?? 'root', projectId);
return !tree.some((f: { name: string }) => f.name === name);
} Type guard
import { FolderNotFoundError } from '...';
const isFolderNotFound = (e: unknown): e is FolderNotFoundError => e instanceof FolderNotFoundError; Try / catch
try { await createFolder(payload, projectId); }
catch (e) {
if (e instanceof FolderNotFoundError) throw new NotFoundError(e.message);
// everything else is InternalServerError — log e.cause, do not retry blindly
log.error('createFolder failed', { cause: e });
} Prevention
- Distinguish duplicate-name from generic DB errors via the wrapped `cause`.
- Keep DB connections healthy and monitor for transaction failures.
- Add a service-layer uniqueness check before INSERT to give a cleaner error.
When it happens
Trigger: DB constraint violation (duplicate folder name under same parent), transaction failure, repository error, or any service bug during folder creation that is not a missing-folder case.
Common situations: Duplicate folder name where uniqueness is enforced; DB connection issues mid-request; partial transaction state after a crash; service-layer invariant violation.
Understand the failure class
- HTTP status errors: handling 4xx and 5xx responses — how to handle 4xx and 5xx responses properly.
Related errors
- 500
- Project not found
- Could not find the folder: ${folderId}
- Supabase upsert failed: ${error.message}
- Supabase query failed: ${error.message}
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/4ffb7bedce8088e8.
Report an issue: GitHub.