{"record":{"id":"754ae0c9439e34a7","repo":"fish2018/pansou","slug":"w-754ae0","errorCode":null,"errorMessage":"无效十六进制转义: %w","messagePattern":"无效十六进制转义: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"plugin/haitunsou/haitunsou.go","lineNumber":258,"sourceCode":"\t\t\t\t\tindex = lowNext - 1\n\t\t\t\t}\n\t\t\t}\n\t\t\tdecoded = utf8.AppendRune(decoded, r)\n\t\tdefault:\n\t\t\tdecoded = append(decoded, encoded[index])\n\t\t}\n\t}\n\treturn decoded, nil\n}\n\nfunc decodeHexEscape(data []byte, start, length int) (uint64, int, error) {\n\tend := start + length\n\tif start < 0 || end > len(data) {\n\t\treturn 0, start, fmt.Errorf(\"转义序列不完整\")\n\t}\n\tvalue, err := strconv.ParseUint(string(data[start:end]), 16, 16)\n\tif err != nil {\n\t\treturn 0, start, fmt.Errorf(\"无效十六进制转义: %w\", err)\n\t}\n\treturn value, end, nil\n}\n\nfunc convertItem(item searchItem) (model.SearchResult, bool) {\n\trawTitle := cleanText(item.Title)\n\tif rawTitle == \"\" {\n\t\trawTitle = cleanText(item.Name)\n\t}\n\tif rawTitle == \"\" {\n\t\treturn model.SearchResult{}, false\n\t}\n\ttitle, description := splitTitleAndDescription(rawTitle)\n\tif title == \"\" {\n\t\treturn model.SearchResult{}, false\n\t}\n\n\tlinkType, normalizedURL, password := normalizeLink(item.URL, item.Code, item.IsType)","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/haitunsou/haitunsou.go#L240-L276","documentation":"decodeHexEscape calls strconv.ParseUint on the escaped hex digits; when those bytes are not valid hexadecimal, it wraps the parse error as 无效十六进制转义 (invalid hex escape). This indicates the plugin's JS string decoder encountered an escape like \\xZZ or a slice containing non-hex characters.","triggerScenarios":"decodeJSSingleQuotedString encounters a \\x or multi-digit escape whose following bytes fail strconv.ParseUint(...,16,16): non-hex characters, or an empty/garbled slice passed as the escape.","commonSituations":"Upstream site changes obfuscation scheme (e.g. switches to \\u{...} or raw Unicode), so bytes assumed to be hex digits are no longer valid; or page compression/decoding leaves stray bytes inside JS string literals.","solutions":["Dump the failing slice (data[start:end]) to see what characters broke the parse","Extend decodeHexEscape to handle the site's current escape syntax (e.g. \\uXXXX, variable-length escapes)","Check whether the page needs charset conversion (GBK/UTF-8) before decoding","Skip items that fail to decode, using cleanText(rawTitle) as a fallback"],"exampleFix":"// before\nvalue, err := strconv.ParseUint(string(data[start:end]), 16, 16)\nif err != nil {\n    return 0, start, fmt.Errorf(\"无效十六进制转义: %w\", err)\n}\n// after\nvalue, err := strconv.ParseUint(string(data[start:end]), 16, 16)\nif err != nil {\n    return 0, start, fmt.Errorf(\"无效十六进制转义 at %d (%q): %w\", start, data[start:end], err)\n}","handlingStrategy":"try-catch","validationCode":"// Go: verify all escape bytes are hex before decoding\nfor _, b := range data[start : start+length] {\n    if !isHexDigit(b) {\n        return string(data), nil // not a valid escape, use raw\n    }\n}","typeGuard":"func isHexDigit(b byte) bool {\n    return (b >= '0' && b <= '9') || (b >= 'a' && b <= 'f') || (b >= 'A' && b <= 'F')\n}","tryCatchPattern":"value, n, err := decodeHexEscape(data, i+2, 2)\nif err != nil {\n    log.Printf(\"invalid hex escape at %d: %v\", i, err)\n    return string(data), nil // keep raw title on decode failure\n}","preventionTips":["Verify each escape byte is a hex digit before parsing","Track upstream site changes to their JS obfuscation scheme","Include the offending byte slice in error messages for faster diagnosis"],"tags":["go","parsing","hex-escape","encoding"],"backgroundTag":"invalid-argument-format","analyzedSha":"beaa56133755a548ebc51b090b3816e2ae044aa6","analyzedAt":"2026-09-07T00:31:18.025Z","contentChangedAt":"2026-09-07T00:31:18.025Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}