Skip to content

Conversation

@michael-radency
Copy link
Contributor

Summary

This PR introduces a centralized trigger validation system that enforces constraints on specific trigger types during workflow execution and activation.

Changes

New Trigger Configuration Constants

Added two constants in trigger-validation.service.ts:

  • TRIGGERS_PREVENT_TEST_WHILE_ACTIVE - A Set<string> defining trigger types that cannot run test/manual executions while the workflow is active. This addresses limitations in certain triggers (e.g., Kafka) where simultaneous production and test listeners cause conflicts.

  • TRIGGERS_UNIQUE_PARAMETERS - A Record<string, string[]> mapping trigger types to parameter names that must be unique across all active workflows. This prevents resource conflicts (e.g., two active workflows cannot share the same Kafka consumer group ID).

Validation Service

The TriggerValidationService provides two main validation methods:

  1. validateManualExecution() - Called before test/manual runs to:

    • Block test executions for restricted triggers when the workflow is active
    • Check for parameter conflicts with other active workflows
  2. validateWorkflowActivation() - Called before workflow activation to:

    • Ensure unique parameters don't conflict with already-active workflows

Error Handling

  • SingleTriggerError - Renamed SingleWebhookTriggerError, thrown when attempting to test a restricted trigger while the workflow is active
  • TriggerParameterConflictError - Thrown when a parameter value conflicts with an active workflow

Example Configuration

// Triggers that cannot be tested while active
export const TRIGGERS_PREVENT_TEST_WHILE_ACTIVE: Set<string> = new Set([
  'n8n-nodes-base.kafkaTrigger',
]);

// Parameters that must be unique across active workflows
export const TRIGGERS_UNIQUE_PARAMETERS: Record<string, string[]> = {
  'n8n-nodes-base.kafkaTrigger': ['groupId'],
};

Related Linear tickets, Github issues, and Community forum posts

https://linear.app/n8n/issue/NODE-4323/trigger-validation-service

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

@michael-radency michael-radency added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team labels Jan 29, 2026
@codecov
Copy link

codecov bot commented Jan 29, 2026

Codecov Report

❌ Patch coverage is 93.00000% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...es/cli/src/workflows/trigger-validation.service.ts 92.68% 5 Missing and 1 partial ⚠️
packages/cli/src/webhooks/test-webhooks.ts 50.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 9 files

@blacksmith-sh
Copy link

blacksmith-sh bot commented Jan 29, 2026

Found 45 test failures on Blacksmith runners:

Failures

Test View Logs
tests/e2e/building-blocks/node-details-configuration.spec.ts/
Node Details Configuration › should auto-detect parameter types
View Logs
tests/e2e/building-blocks/node-details-configuration.spec.ts/
Node Details Configuration › should configure Edit Fields node with all field types
View Logs
tests/e2e/building-blocks/node-details-configuration.spec.ts/
Node Details Configuration › should configure Edit Fields node with multiple fields
View Logs
tests/e2e/building-blocks/node-details-configuration.spec.ts/
Node Details Configuration › should configure Edit Fields node with single field
View Logs
tests/e2e/building-blocks/node-details-configuration.spec.ts/
Node Details Configuration › should configure HTTP Request node
View Logs
tests/e2e/building-blocks/node-details-configuration.spec.ts/
Node Details Configuration › should configure webhook node
View Logs
tests/e2e/building-blocks/node-details-configuration.spec.ts/
Node Details Configuration › should use explicit types for better performance
View Logs
tests/e2e/node-creator/actions.spec.ts/
Node Creator Actions › should add node to canvas from actions panel
View Logs
tests/e2e/node-creator/actions.spec.ts/
Node Creator Actions › should add node with specific operation configuration
View Logs
tests/e2e/node-creator/actions.spec.ts/
Node Creator Actions › should search through actions and confirm added action
View Logs
tests/e2e/node-creator/actions.spec.ts/
Node Creator Actions › should show multiple actions for multi-action nodes
View Logs
tests/e2e/nodes/community-nodes.spec.ts/
Community and custom nodes in canvas › should render and select community node
View Logs
tests/e2e/nodes/community-nodes.spec.ts/
Community and custom nodes in canvas › should render custom node with custom credential
View Logs
tests/e2e/nodes/community-nodes.spec.ts/
Community and custom nodes in canvas › should render custom node with n8n credential
View Logs
tests/e2e/nodes/http-request-node.spec.ts/
HTTP Request node › Credential-only HTTP Request Node variants › should render a modifi
ed HTTP Request Node
View Logs
tests/e2e/nodes/http-request-node.spec.ts/
HTTP Request node › should make a request with a URL and receive a response
View Logs
tests/e2e/projects/project-settings.spec.ts/
Project Settings - Member Management › should allow editing project name and descriptio
n @auth:owner
View Logs
tests/e2e/projects/project-settings.spec.ts/
Project Settings - Member Management › should display delete project section with warni
ng @auth:owner
View Logs
tests/e2e/projects/project-settings.spec.ts/
Project Settings - Member Management › should display members table with correct struct
ure @auth:owner
View Logs
tests/e2e/projects/project-settings.spec.ts/
Project Settings - Member Management › should display project settings page with correc
t layout @auth:owner
View Logs
tests/e2e/projects/project-settings.spec.ts/
Project Settings - Member Management › should display role dropdown for members but not
for current user @auth:owner
View Logs
tests/e2e/projects/project-settings.spec.ts/
Project Settings - Member Management › should handle unsaved changes state @auth:owner
View Logs
tests/e2e/projects/project-settings.spec.ts/
Project Settings - Member Management › should persist settings after page reload @auth:
owner
View Logs
tests/e2e/projects/project-settings.spec.ts/
Project Settings - Member Management › should show project settings form validation @au
th:owner
View Logs
tests/e2e/settings/community-nodes/community-nodes.spec.ts/
Community nodes management › can install, update and uninstall community nodes
View Logs
tests/e2e/workflows/checklist/production-checklist.spec.ts/
Workflow Production Checklist › should allow ignoring all actions with confirmation
View Logs
tests/e2e/workflows/checklist/production-checklist.spec.ts/
Workflow Production Checklist › should allow ignoring individual actions
View Logs
tests/e2e/workflows/checklist/production-checklist.spec.ts/
Workflow Production Checklist › should display evaluations action when AI node exists a
nd feature is enabled
View Logs
tests/e2e/workflows/checklist/production-checklist.spec.ts/
Workflow Production Checklist › should open workflow settings modal when error workflow
action is clicked
View Logs
tests/e2e/workflows/checklist/production-checklist.spec.ts/
Workflow Production Checklist › should open workflow settings modal when time saved act
ion is clicked
View Logs
tests/e2e/workflows/checklist/production-checklist.spec.ts/
Workflow Production Checklist › should show suggested actions automatically when workfl
ow is first published
View Logs
tests/e2e/workflows/editor/canvas/undo-redo.spec.ts/Undo/
Redo › should be able to copy and paste pinned data nodes in workflows with dynamic Swi
tch node
View Logs
tests/e2e/workflows/editor/canvas/undo-redo.spec.ts/Undo/Redo › should not undo/
redo when NDV or a modal is open
View Logs
tests/e2e/workflows/editor/canvas/undo-redo.spec.ts/Undo/Redo › should not undo/
redo when NDV or a prompt is open
View Logs
tests/e2e/workflows/editor/canvas/undo-redo.spec.ts/Undo/Redo › should undo/
redo deleting a connection using context menu
View Logs
tests/e2e/workflows/editor/canvas/undo-redo.spec.ts/Undo/Redo › should undo/
redo deleting node between two connected nodes
View Logs
tests/e2e/workflows/editor/canvas/undo-redo.spec.ts/Undo/Redo › should undo/
redo deleting node using context menu
View Logs
tests/e2e/workflows/editor/canvas/undo-redo.spec.ts/Undo/Redo › should undo/
redo deleting node using keyboard shortcut
View Logs
tests/e2e/workflows/editor/canvas/undo-redo.spec.ts/Undo/Redo › should undo/
redo deleting whole workflow
View Logs
tests/e2e/workflows/editor/canvas/undo-redo.spec.ts/Undo/Redo › should undo/
redo disabling a node using context menu
View Logs
tests/e2e/workflows/editor/canvas/undo-redo.spec.ts/Undo/Redo › should undo/
redo disabling a node using keyboard shortcut
View Logs
tests/e2e/workflows/editor/canvas/undo-redo.spec.ts/Undo/Redo › should undo/
redo disabling multiple nodes
View Logs
tests/e2e/workflows/editor/canvas/undo-redo.spec.ts/Undo/Redo › should undo/
redo duplicating a node
View Logs
tests/e2e/workflows/editor/canvas/undo-redo.spec.ts/Undo/Redo › should undo/
redo moving nodes
View Logs
tests/e2e/workflows/editor/canvas/undo-redo.spec.ts/Undo/Redo › should undo/
redo pasting nodes
View Logs

Fix in Cursor

@blacksmith-sh
Copy link

blacksmith-sh bot commented Jan 29, 2026

Found 45 test failures on Blacksmith runners:

Failures

Test View Logs
tests/e2e/building-blocks/node-details-configuration.spec.ts/
Node Details Configuration › should auto-detect parameter types
View Logs
tests/e2e/building-blocks/node-details-configuration.spec.ts/
Node Details Configuration › should configure Edit Fields node with all field types
View Logs
tests/e2e/building-blocks/node-details-configuration.spec.ts/
Node Details Configuration › should configure Edit Fields node with multiple fields
View Logs
tests/e2e/building-blocks/node-details-configuration.spec.ts/
Node Details Configuration › should configure Edit Fields node with single field
View Logs
tests/e2e/building-blocks/node-details-configuration.spec.ts/
Node Details Configuration › should configure HTTP Request node
View Logs
tests/e2e/building-blocks/node-details-configuration.spec.ts/
Node Details Configuration › should configure webhook node
View Logs
tests/e2e/building-blocks/node-details-configuration.spec.ts/
Node Details Configuration › should use explicit types for better performance
View Logs
tests/e2e/node-creator/actions.spec.ts/
Node Creator Actions › should add node to canvas from actions panel
View Logs
tests/e2e/node-creator/actions.spec.ts/
Node Creator Actions › should add node with specific operation configuration
View Logs
tests/e2e/node-creator/actions.spec.ts/
Node Creator Actions › should search through actions and confirm added action
View Logs
tests/e2e/node-creator/actions.spec.ts/
Node Creator Actions › should show multiple actions for multi-action nodes
View Logs
tests/e2e/nodes/community-nodes.spec.ts/
Community and custom nodes in canvas › should render and select community node
View Logs
tests/e2e/nodes/community-nodes.spec.ts/
Community and custom nodes in canvas › should render custom node with custom credential
View Logs
tests/e2e/nodes/community-nodes.spec.ts/
Community and custom nodes in canvas › should render custom node with n8n credential
View Logs
tests/e2e/nodes/http-request-node.spec.ts/
HTTP Request node › Credential-only HTTP Request Node variants › should render a modifi
ed HTTP Request Node
View Logs
tests/e2e/nodes/http-request-node.spec.ts/
HTTP Request node › should make a request with a URL and receive a response
View Logs
tests/e2e/projects/project-settings.spec.ts/
Project Settings - Member Management › should allow editing project name and descriptio
n @auth:owner
View Logs
tests/e2e/projects/project-settings.spec.ts/
Project Settings - Member Management › should display delete project section with warni
ng @auth:owner
View Logs
tests/e2e/projects/project-settings.spec.ts/
Project Settings - Member Management › should display members table with correct struct
ure @auth:owner
View Logs
tests/e2e/projects/project-settings.spec.ts/
Project Settings - Member Management › should display project settings page with correc
t layout @auth:owner
View Logs
tests/e2e/projects/project-settings.spec.ts/
Project Settings - Member Management › should display role dropdown for members but not
for current user @auth:owner
View Logs
tests/e2e/projects/project-settings.spec.ts/
Project Settings - Member Management › should handle unsaved changes state @auth:owner
View Logs
tests/e2e/projects/project-settings.spec.ts/
Project Settings - Member Management › should persist settings after page reload @auth:
owner
View Logs
tests/e2e/projects/project-settings.spec.ts/
Project Settings - Member Management › should show project settings form validation @au
th:owner
View Logs
tests/e2e/settings/community-nodes/community-nodes.spec.ts/
Community nodes management › can install, update and uninstall community nodes
View Logs
tests/e2e/workflows/checklist/production-checklist.spec.ts/
Workflow Production Checklist › should allow ignoring all actions with confirmation
View Logs
tests/e2e/workflows/checklist/production-checklist.spec.ts/
Workflow Production Checklist › should allow ignoring individual actions
View Logs
tests/e2e/workflows/checklist/production-checklist.spec.ts/
Workflow Production Checklist › should display evaluations action when AI node exists a
nd feature is enabled
View Logs
tests/e2e/workflows/checklist/production-checklist.spec.ts/
Workflow Production Checklist › should open workflow settings modal when error workflow
action is clicked
View Logs
tests/e2e/workflows/checklist/production-checklist.spec.ts/
Workflow Production Checklist › should open workflow settings modal when time saved act
ion is clicked
View Logs
tests/e2e/workflows/checklist/production-checklist.spec.ts/
Workflow Production Checklist › should show suggested actions automatically when workfl
ow is first published
View Logs
tests/e2e/workflows/editor/canvas/undo-redo.spec.ts/Undo/
Redo › should be able to copy and paste pinned data nodes in workflows with dynamic Swi
tch node
View Logs
tests/e2e/workflows/editor/canvas/undo-redo.spec.ts/Undo/Redo › should not undo/
redo when NDV or a modal is open
View Logs
tests/e2e/workflows/editor/canvas/undo-redo.spec.ts/Undo/Redo › should not undo/
redo when NDV or a prompt is open
View Logs
tests/e2e/workflows/editor/canvas/undo-redo.spec.ts/Undo/Redo › should undo/
redo deleting a connection using context menu
View Logs
tests/e2e/workflows/editor/canvas/undo-redo.spec.ts/Undo/Redo › should undo/
redo deleting node between two connected nodes
View Logs
tests/e2e/workflows/editor/canvas/undo-redo.spec.ts/Undo/Redo › should undo/
redo deleting node using context menu
View Logs
tests/e2e/workflows/editor/canvas/undo-redo.spec.ts/Undo/Redo › should undo/
redo deleting node using keyboard shortcut
View Logs
tests/e2e/workflows/editor/canvas/undo-redo.spec.ts/Undo/Redo › should undo/
redo deleting whole workflow
View Logs
tests/e2e/workflows/editor/canvas/undo-redo.spec.ts/Undo/Redo › should undo/
redo disabling a node using context menu
View Logs
tests/e2e/workflows/editor/canvas/undo-redo.spec.ts/Undo/Redo › should undo/
redo disabling a node using keyboard shortcut
View Logs
tests/e2e/workflows/editor/canvas/undo-redo.spec.ts/Undo/Redo › should undo/
redo disabling multiple nodes
View Logs
tests/e2e/workflows/editor/canvas/undo-redo.spec.ts/Undo/Redo › should undo/
redo duplicating a node
View Logs
tests/e2e/workflows/editor/canvas/undo-redo.spec.ts/Undo/Redo › should undo/
redo moving nodes
View Logs
tests/e2e/workflows/editor/canvas/undo-redo.spec.ts/Undo/Redo › should undo/
redo pasting nodes
View Logs

Fix in Cursor

Copy link
Contributor

@mfsiega mfsiega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the general approach!

I do worry that there are a lot of tricky corner cases.

Haven't taken a full look line-by-line yet.

* Parameters that must be unique across all active workflows, keyed by trigger type.
*/
export const TRIGGERS_UNIQUE_PARAMETERS: Record<string, string[]> = {
'n8n-nodes-base.kafkaTrigger': ['groupId'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strictly speaking we still can't prevent this, because we support expressions, right? But of course it helps if somebody does this accidentally.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true, but I do think that this is unlikely, as it isfor triggers

// Check whether this workflow is active.
const workflowIsActive = await this.workflowRepository.isActive(payload.workflowData.id);

const triggerToStartFrom =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we probably want to move this lower, down around line 221? Since in between here and there we do some work to potentially choose the relevant trigger (e.g., if it's a partial execution to a destination node, we pick a trigger on the backend).

There's also the question of pinned data - if we have pinned data for the trigger we won't actually end up activating it. So in that case, I think we would want to allow it.

return false;
}

await this.triggerValidation.validateWorkflowActivation(workflow);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have some existing validation in the WorkflowService.activateWorkflow, which I think is a slightly better place for this. Should it live there instead? (And maybe we can unify some of the logic a bit?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants