Skip to content

Commit

Permalink
refactor(core): Report malformed execution data (n8n-io#12525)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivov authored Jan 9, 2025
1 parent a9077bb commit 7583e2a
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions packages/core/src/WorkflowExecute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1210,7 +1210,27 @@ export class WorkflowExecute {

this.status = 'running';

const startNode = this.runExecutionData.executionData!.nodeExecutionStack[0].node.name;
if (!this.runExecutionData.executionData) {
throw new ApplicationError('Failed to run workflow due to missing execution data', {
extra: {
workflowId: workflow.id,
executionid: this.additionalData.executionId,
mode: this.mode,
},
});
}

const startNode = this.runExecutionData.executionData.nodeExecutionStack.at(0)?.node.name;

if (!startNode) {
throw new ApplicationError('Failed to run workflow due to empty node execution stack', {
extra: {
workflowId: workflow.id,
executionId: this.additionalData.executionId,
mode: this.mode,
},
});
}

let destinationNode: string | undefined;
if (this.runExecutionData.startData && this.runExecutionData.startData.destinationNode) {
Expand Down Expand Up @@ -1245,7 +1265,7 @@ export class WorkflowExecute {

if (this.runExecutionData.waitTill) {
const lastNodeExecuted = this.runExecutionData.resultData.lastNodeExecuted as string;
this.runExecutionData.executionData!.nodeExecutionStack[0].node.disabled = true;
this.runExecutionData.executionData.nodeExecutionStack[0].node.disabled = true;
this.runExecutionData.waitTill = undefined;
this.runExecutionData.resultData.runData[lastNodeExecuted].pop();
}
Expand Down

0 comments on commit 7583e2a

Please sign in to comment.