@@ -15,6 +15,7 @@ import {
1515 TriggerUtils ,
1616} from '@/lib/workflows/triggers/triggers'
1717import { useCurrentWorkflow } from '@/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-current-workflow'
18+ import { getBlock } from '@/blocks'
1819import type { SerializableExecutionState } from '@/executor/execution/types'
1920import type { BlockLog , BlockState , ExecutionResult , StreamingExecution } from '@/executor/types'
2021import { hasExecutionResult } from '@/executor/utils/errors'
@@ -1477,8 +1478,29 @@ export function useWorkflowExecution() {
14771478 const candidates = resolveStartCandidates ( mergedStates , { execution : 'manual' } )
14781479 const candidate = candidates . find ( ( c ) => c . blockId === blockId )
14791480
1481+ logger . info ( 'Run-from-block trigger analysis' , {
1482+ blockId,
1483+ blockType : workflowBlocks [ blockId ] ?. type ,
1484+ blockTriggerMode : workflowBlocks [ blockId ] ?. triggerMode ,
1485+ candidateFound : ! ! candidate ,
1486+ candidatePath : candidate ?. path ,
1487+ allCandidates : candidates . map ( ( c ) => ( {
1488+ blockId : c . blockId ,
1489+ type : c . block . type ,
1490+ path : c . path ,
1491+ } ) ) ,
1492+ } )
1493+
14801494 if ( candidate ) {
1481- if ( triggerNeedsMockPayload ( candidate ) ) {
1495+ const needsMockPayload = triggerNeedsMockPayload ( candidate )
1496+ logger . info ( 'Trigger mock payload check' , {
1497+ needsMockPayload,
1498+ path : candidate . path ,
1499+ isExternalTrigger : candidate . path === StartBlockPath . EXTERNAL_TRIGGER ,
1500+ blockType : candidate . block . type ,
1501+ } )
1502+
1503+ if ( needsMockPayload ) {
14821504 workflowInput = extractTriggerMockPayload ( candidate )
14831505 logger . info ( 'Extracted mock payload for trigger block' , { blockId, workflowInput } )
14841506 } else if (
@@ -1500,6 +1522,32 @@ export function useWorkflowExecution() {
15001522 }
15011523 }
15021524 }
1525+ } else {
1526+ // Fallback for trigger blocks not found in candidates
1527+ // This can happen when the block is a trigger by position (no incoming edges)
1528+ // but wasn't classified as a start candidate (e.g., triggerMode not set)
1529+ const block = mergedStates [ blockId ]
1530+ if ( block ) {
1531+ const blockConfig = getBlock ( block . type )
1532+ const hasTriggers = blockConfig ?. triggers ?. available ?. length
1533+
1534+ if ( hasTriggers || block . triggerMode ) {
1535+ // Block has trigger capability - extract mock payload
1536+ const syntheticCandidate = {
1537+ blockId,
1538+ block,
1539+ path : StartBlockPath . EXTERNAL_TRIGGER ,
1540+ }
1541+ workflowInput = extractTriggerMockPayload ( syntheticCandidate )
1542+ logger . info ( 'Extracted mock payload for trigger block (fallback)' , {
1543+ blockId,
1544+ blockType : block . type ,
1545+ hasTriggers,
1546+ triggerMode : block . triggerMode ,
1547+ workflowInput,
1548+ } )
1549+ }
1550+ }
15031551 }
15041552 }
15051553
0 commit comments