All skillsRequire NodeApiError or NodeOperationError for error wrapping in catch blocks. Raw errors lose HTTP context in the n8n UI (
Skillintermediate
Require NodeApiError or NodeOperationError for error wrapping in catch blocks. Raw errors lose HTTP context in the n8n UI (`@n8n/community-nodes/requi
š¼ This rule is enabled in the following configs: ā `recommended`, āļø `recommendedWithoutN8nCloudSupport`.
Claude Code Knowledge Pack7/10/2026
Overview
Require NodeApiError or NodeOperationError for error wrapping in catch blocks. Raw errors lose HTTP context in the n8n UI (@n8n/community-nodes/require-node-api-error)
š¼ This rule is enabled in the following configs: ā
recommended, āļø recommendedWithoutN8nCloudSupport.
Rule Details
When errors are caught and re-thrown in n8n nodes, they must be wrapped in
NodeApiError or NodeOperationError. Raw re-throws and generic Error
constructors lose HTTP context (status code, response body, etc.) that the n8n
UI relies on to display meaningful error information to users.
Examples
Incorrect
try {
await apiRequest();
} catch (error) {
throw error;
}
try {
await apiRequest();
} catch (error) {
throw new Error('Request failed');
}
Correct
try {
await apiRequest();
} catch (error) {
throw new NodeApiError(this.getNode(), error as JsonObject);
}
try {
await apiRequest();
} catch (error) {
throw new NodeOperationError(this.getNode(), 'Operation failed', { itemIndex: i });
}
try {
await apiRequest();
} catch (error) {
if (this.continueOnFail()) {
returnData.push({ json: { error: error.message } });
continue;
}
throw new NodeApiError(this.getNode(), error as JsonObject);
}