{"record":{"id":"8d7e6b0428fe2f95","repo":"projectdiscovery/nuclei","slug":"invalid-address-q-w","errorCode":null,"errorMessage":"invalid address %q: %w","messagePattern":"invalid address %q: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/js/libs/gptransport/dialer.go","lineNumber":48,"sourceCode":"// given executionId. Every connection made through the returned dialer is\n// validated against the execution's network policy and routed through the\n// matching fastdialer.\nfunc NewExecDialer(execID string) *gptr.Dialer {\n\tif execID == \"\" {\n\t\treturn &gptr.Dialer{}\n\t}\n\treturn &gptr.Dialer{\n\t\tDialFn: func(ctx context.Context, network, address string) (net.Conn, error) {\n\t\t\treturn DialWithExec(ctx, execID, network, address)\n\t\t},\n\t}\n}\n\n// DialWithExec performs the fastdialer dial after enforcing host policy.\nfunc DialWithExec(ctx context.Context, execID, network, address string) (net.Conn, error) {\n\thost, _, err := net.SplitHostPort(address)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid address %q: %w\", address, err)\n\t}\n\tif !protocolstate.IsHostAllowed(execID, host) {\n\t\treturn nil, protocolstate.ErrHostDenied.Msgf(host)\n\t}\n\tdialer := protocolstate.GetDialersWithId(execID)\n\tif dialer == nil || dialer.Fastdialer == nil {\n\t\treturn nil, fmt.Errorf(\"goimpacket: no fastdialer registered for executionId %q\", execID)\n\t}\n\treturn dialer.Fastdialer.Dial(ctx, network, address)\n}\n\n// ExecutionIDFromCtx pulls the executionId set by nuclei on its goja runtime\n// or scan context. Returns \"\" when the context carries no id.\nfunc ExecutionIDFromCtx(ctx context.Context) string {\n\tif ctx == nil {\n\t\treturn \"\"\n\t}\n\tif v := ctx.Value(\"executionId\"); v != nil {","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/projectdiscovery/nuclei/blob/265b3a3dec374741614e342f813c10f8b38d2bb7/pkg/js/libs/gptransport/dialer.go#L30-L66","documentation":"DialWithExec could not split the address into host and port because net.SplitHostPort failed. Every address handed to the execution-bound goimpacket dialer must be in host:port form; IPv6 literals must be bracketed. The malformed address is reported verbatim in the message.","triggerScenarios":"Dialing with '127.0.0.1' or 'dc.acme.local' (no ':445' port suffix); IPv6 written as '::1:445' instead of '[::1]:445'; empty address string; address with stray whitespace or an extra colon.","commonSituations":"SMB/RPC libraries building targets as hostname-only strings; config storing host and port separately with a broken join; IPv6 targets from dual-stack scans; variables interpolated without trimming.","solutions":["Always pass host:port, building it with net.JoinHostPort(host, \"445\")","Bracket IPv6 literals before appending the port: '[::1]:445'","Trim and reject empty addresses at config-parse time before any dial"],"exampleFix":"// before\nconn, err := gptransport.DialWithExec(ctx, execID, \"tcp\", host)\n\n// after: JoinHostPort is IPv6-safe and guarantees host:port\naddr := net.JoinHostPort(strings.TrimSpace(host), \"445\")\nconn, err := gptransport.DialWithExec(ctx, execID, \"tcp\", addr)","handlingStrategy":"validation","validationCode":"if _, _, err := net.SplitHostPort(address); err != nil {\n    address = net.JoinHostPort(host, port) // rebuild correctly before dialing\n}\nconn, err := gptransport.DialWithExec(ctx, execID, \"tcp\", address)","typeGuard":"func isDialableAddress(addr string) bool {\n    _, _, err := net.SplitHostPort(addr)\n    return err == nil\n}","tryCatchPattern":"if err != nil && strings.HasPrefix(err.Error(), \"invalid address\") {\n    // rebuild with net.JoinHostPort and retry once; otherwise surface the bad address","preventionTips":["Build every dial address with net.JoinHostPort(host, port)","Bracket IPv6 literals before appending a port","Reject empty host or port strings when parsing configuration"],"tags":["network","go","address-validation"],"backgroundTag":null,"analyzedSha":"265b3a3dec374741614e342f813c10f8b38d2bb7","analyzedAt":"2026-08-15T20:05:51.855Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}