{"record":{"id":"a7e1aee468aae8e8","repo":"VictoriaMetrics/VictoriaMetrics","slug":"dial-error-w","errorCode":null,"errorMessage":"dial error: %w","messagePattern":"dial error: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/handshake/handshake.go","lineNumber":39,"sourceCode":"\n\tsuccessResponse = \"ok\"\n)\n\n// Func must perform handshake on the given c using the given compressionLevel.\n//\n// It must return BufferedConn wrapper for c on successful handshake.\ntype Func func(c net.Conn, compressionLevel int) (*BufferedConn, error)\n\n// VMInsertClientWithDialer performs client-side handshake for vminsert protocol.\n//\n// it uses provided dial func to establish connection to the server.\n// compressionLevel is a legacy option which defines the level used for compression of the data sent\n// to the server.\n// compressionLevel <= 0 means 'no compression'\nfunc VMInsertClientWithDialer(dial func() (net.Conn, error), compressionLevel int) (*BufferedConn, error) {\n\tc, err := dial()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"dial error: %w\", err)\n\t}\n\tbc, err := vminsertClient(c, 0)\n\tif err == nil {\n\t\treturn bc, nil\n\t}\n\t_ = c.Close()\n\t// fallback only if vmstorage closed connection at read success response\n\tif !errors.Is(err, io.EOF) && !strings.Contains(err.Error(), \"cannot read success response after sending hello\") {\n\t\treturn nil, err\n\t}\n\t// try to fallback to the prev non-RPC API version\n\t// we cannot re-use exist connection, since vmstorage already closed it\n\tc, err = dial()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"dial error: %w\", err)\n\t}\n\tbc, err = genericClient(c, vminsertHelloLegacyVersion, compressionLevel)\n\tif err != nil {","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/VictoriaMetrics/VictoriaMetrics/blob/5079fb58f1e8e62113f90c945ad71586c797d770/lib/handshake/handshake.go#L21-L57","documentation":"Fires in VMInsertClientWithDialer when the provided dial function fails to establish the TCP connection to the server before the handshake. The wrapped net error identifies DNS failure, connection refused, or timeout; the input at fault is the dialed address.","triggerScenarios":"Thrown at lib/handshake/handshake.go:39 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the target address resolves and the port is open","Check firewall/security-group rules between client and server","Retry — transient network failures are common in mesh environments"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5079fb58f1e8e62113f90c945ad71586c797d770","analyzedAt":"2026-09-03T18:10:26.153Z","contentChangedAt":"2026-09-03T18:10:26.153Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}