{"record":{"id":"ac64e81c36831c50","repo":"projectdiscovery/nuclei","slug":"dialers-not-initialized-for-s-ac64e8","errorCode":null,"errorMessage":"dialers not initialized for %s","messagePattern":"dialers not initialized for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/js/libs/net/net.go","lineNumber":32,"sourceCode":"\t\"github.com/projectdiscovery/utils/reader\"\n)\n\nvar (\n\tdefaultTimeout = time.Duration(5) * time.Second\n)\n\n// Open opens a new connection to the address with a timeout.\n// supported protocols: tcp, udp\n// @example\n// ```javascript\n// const net = require('nuclei/net');\n// const conn = net.Open('tcp', 'acme.com:80');\n// ```\nfunc Open(ctx context.Context, protocol, address string) (*NetConn, error) {\n\texecutionId := ctx.Value(\"executionId\").(string)\n\tdialer := protocolstate.GetDialersWithId(executionId)\n\tif dialer == nil {\n\t\treturn nil, fmt.Errorf(\"dialers not initialized for %s\", executionId)\n\t}\n\tconn, err := dialer.Fastdialer.Dial(ctx, protocol, address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &NetConn{conn: conn, timeout: defaultTimeout}, nil\n}\n\n// Open opens a new connection to the address with a timeout.\n// supported protocols: tcp, udp\n// @example\n// ```javascript\n// const net = require('nuclei/net');\n// const conn = net.OpenTLS('tcp', 'acme.com:443');\n// ```\nfunc OpenTLS(ctx context.Context, protocol, address string) (*NetConn, error) {\n\tconfig := &tls.Config{InsecureSkipVerify: true, MinVersion: tls.VersionTLS10}\n\thost, _, _ := net.SplitHostPort(address)","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/projectdiscovery/nuclei/blob/265b3a3dec374741614e342f813c10f8b38d2bb7/pkg/js/libs/net/net.go#L14-L50","documentation":"Returned by nuclei's net.Open when protocolstate.GetDialersWithId(executionId) returns nil — the per-execution dialer set (fastdialer plus network policy) was never initialized for the executionId in the JS context. Every raw socket the JS runtime opens is routed through these dialers, so without them Open fails before any connection attempt. Dialers are registered by protocolstate.Init(options) keyed on options.ExecutionId.","triggerScenarios":"Executing require('nuclei/net') code outside the nuclei engine: standalone goja, direct Go calls to net.Open in tests, or an SDK that constructs its own execution context without engine setup. Also any executionId mismatch between the ctx value and the id used at Init.","commonSituations":"Custom Go runners embedding nuclei libs; unit tests of JS helper code; tooling that extracts and runs nuclei JS snippets; stale contexts reused after execution-id rotation.","solutions":["Run JS through the nuclei engine (CLI / lib/nuclei NewEngine) so protocolstate.Init runs with the right ExecutionId","When embedding, call protocolstate.Init(&types.Options{ExecutionId: id, ...}) before execution and carry the identical id under ctx key 'executionId'","Debug the context: log ctx.Value('executionId') and compare with the initialized id","For pure library tests, init protocolstate in TestMain instead of mocking piecemeal"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Go embedder guard\nif protocolstate.GetDialersWithId(executionId) == nil {\n    _ = protocolstate.Init(&types.Options{ExecutionId: executionId})\n}\n// then run the JS that calls net.Open","typeGuard":null,"tryCatchPattern":"try { const conn = net.Open('tcp', addr); } catch (e) { if (String(e).includes('dialers not initialized')) { log('run this template via the nuclei engine'); return; } throw e; }","preventionTips":["Execute net.* code only inside nuclei engine executions","Embedders: Init dialers per execution id before evaluating scripts","Keep the executionId consistent between Init and ctx","Don't extract net helpers into standalone runtimes"],"tags":["network","runtime-initialization","configuration","sdk"],"backgroundTag":null,"analyzedSha":"265b3a3dec374741614e342f813c10f8b38d2bb7","analyzedAt":"2026-08-15T20:05:51.855Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}