{"record":{"id":"0efa06296da1b390","repo":"projectdiscovery/nuclei","slug":"could-not-create-flow-executor-s","errorCode":null,"errorMessage":"could not create flow executor: %s","messagePattern":"could not create flow executor: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/tmplexec/exec.go","lineNumber":205,"sourceCode":"\t\t\t\tmatched.Store(true)\n\t\t\t} else {\n\t\t\t\tlastMatcherEvent = event\n\t\t\t}\n\t\t}\n\t}\n\tvar errx error\n\n\t// Note: this is required for flow executor\n\t// flow executer is tightly coupled with lot of executor options\n\t// and map , wg and other types earlier we tried to use (compile once and run multiple times)\n\t// but it is causing lot of panic and nil pointer dereference issues\n\t// so in compile step earlier we compile it to validate javascript syntax and other things\n\t// and while executing we create new instance of flow executor everytime\n\tif e.options.Flow != \"\" {\n\t\tflowexec, err := flow.NewFlowExecutor(e.requests, ctx, e.options, executed, e.program)\n\t\tif err != nil {\n\t\t\tctx.LogError(err)\n\t\t\treturn false, fmt.Errorf(\"could not create flow executor: %s\", err)\n\t\t}\n\t\tif err := flowexec.Compile(); err != nil {\n\t\t\tctx.LogError(err)\n\t\t\treturn false, err\n\t\t}\n\t\terrx = flowexec.ExecuteWithResults(ctx)\n\t} else {\n\t\terrx = e.engine.ExecuteWithResults(ctx)\n\t}\n\tctx.LogError(errx)\n\n\tif lastMatcherEvent != nil {\n\t\tlastMatcherEvent.Lock()\n\t\tdefer lastMatcherEvent.Unlock()\n\n\t\tlastMatcherEvent.InternalEvent[\"error\"] = getErrorCause(ctx.GenerateErrorMessage())\n\n\t\twriteFailureCallback(lastMatcherEvent, e.options.Options.MatcherStatus)","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/projectdiscovery/nuclei/blob/265b3a3dec374741614e342f813c10f8b38d2bb7/pkg/tmplexec/exec.go#L187-L223","documentation":"In pkg/tmplexec/exec.go (Execute path), nuclei builds a fresh FlowExecutor per target because the flow executor is tightly coupled with executor options and scan context. If flow.NewFlowExecutor returns an error, execution of this template/target stops with 'could not create flow executor: %s'. In practice the only error NewFlowExecutor returns is 'invalid request type %s' — a request whose Type() is not in the flow engine's supported switch.","triggerScenarios":"A template with a `flow:` block that also contains a request section the flow engine's switch does not handle (WorkflowProtocol or InvalidProtocol types, or a protocol type added in a newer nuclei than the running binary supports). The compile-time check (error 461) only validates JS syntax, so this surfaces later at Execute time on the first target.","commonSituations":"Version skew: running a new community template with flow against an older nuclei binary whose flow switch lacked a protocol; SDK users assembling custom protocols.Request implementations and enabling options.Flow; editing a template to add an exotic protocol section while keeping `flow:`.","solutions":["Upgrade nuclei to the latest release so the flow engine's protocol switch matches current template capabilities","Remove `flow:` from the template, or remove the request section whose protocol the flow engine cannot dispatch","Run `nuclei -validate` and verify each protocol section in the template is one of: dns, file, http, offline-http, headless, tcp/network, ssl, websocket, whois, code, javascript","If using the SDK with custom Request implementations, map them to a supported Type() or drop the flow path"],"exampleFix":"# before: flow + workflow-style or unsupported section\nflow: |\n  http() && ssl()\nworkflow:\n  - template: other.yaml\n\n# after: keep flow, move workflow logic into plain templates without flow","handlingStrategy":"try-catch","validationCode":"// Before executing a flow template, verify every request type is dispatchable:\nfunc flowDispatchable(reqs []protocols.Request) bool {\n    for _, r := range reqs {\n        switch r.Type() {\n        case templateTypes.DNSProtocol, templateTypes.FileProtocol, templateTypes.HTTPProtocol,\n            templateTypes.OfflineHTTPProtocol, templateTypes.HeadlessProtocol, templateTypes.NetworkProtocol,\n            templateTypes.SSLProtocol, templateTypes.WebsocketProtocol, templateTypes.WHOISProtocol,\n            templateTypes.CodeProtocol, templateTypes.JavascriptProtocol:\n        default:\n            return false\n        }\n    }\n    return true\n}","typeGuard":null,"tryCatchPattern":"ok, err := executer.Execute(scanCtx)\nif err != nil {\n    if strings.Contains(err.Error(), \"could not create flow executor\") {\n        // template/binary protocol-support mismatch: skip template, suggest upgrade\n        log.Printf(\"skipping flow template %s (unsupported request type) — upgrade nuclei\", tid)\n        continue\n    }\n    return err\n}","preventionTips":["Keep nuclei and nuclei-templates versions in lockstep","Pre-check request Type() against the flow engine's switch before enabling Flow in SDK code","Reject community templates containing `flow:` plus exotic protocol sections during your template ingestion step"],"tags":["flow","executor","template","version-skew"],"backgroundTag":null,"analyzedSha":"265b3a3dec374741614e342f813c10f8b38d2bb7","analyzedAt":"2026-08-15T20:05:51.855Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}