{"record":{"id":"2bcc71e9d33d0766","repo":"XTLS/Xray-core","slug":"invalid-header-v","errorCode":null,"errorMessage":"invalid header: %v","messagePattern":"invalid header: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/vless/encryption/common.go","lineNumber":218,"sourceCode":"func DecodeLength(b []byte) int {\n\treturn int(b[0])<<8 | int(b[1])\n}\n\nfunc EncodeHeader(h []byte, l int) {\n\th[0] = 23\n\th[1] = 3\n\th[2] = 3\n\th[3] = byte(l >> 8)\n\th[4] = byte(l)\n}\n\nfunc DecodeHeader(h []byte) (l int, err error) {\n\tl = int(h[3])<<8 | int(h[4])\n\tif h[0] != 23 || h[1] != 3 || h[2] != 3 {\n\t\tl = 0\n\t}\n\tif l < 17 || l > 16640 { // TLS 1.3 max record: 16384 + 256 (RFC 8446 §5.2)\n\t\terr = errors.New(\"invalid header: \" + fmt.Sprintf(\"%v\", h[:5])) // DO NOT CHANGE: relied by client's Read()\n\t}\n\treturn\n}\n\nfunc ParsePadding(padding string, paddingLens, paddingGaps *[][3]int) (err error) {\n\tif padding == \"\" {\n\t\treturn\n\t}\n\tmaxLen := 0\n\tfor i, s := range strings.Split(padding, \".\") {\n\t\tx := strings.Split(s, \"-\")\n\t\tif len(x) < 3 || x[0] == \"\" || x[1] == \"\" || x[2] == \"\" {\n\t\t\treturn errors.New(\"invalid padding lenth/gap parameter: \" + s)\n\t\t}\n\t\ty := [3]int{}\n\t\tif y[0], err = strconv.Atoi(x[0]); err != nil {\n\t\t\treturn\n\t\t}","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/proxy/vless/encryption/common.go#L200-L236","documentation":"Error \"invalid header: %v\" thrown in XTLS/Xray-core.","triggerScenarios":"Thrown at proxy/vless/encryption/common.go:218 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}