{"record":{"id":"8c1c33fee9e37d85","repo":"fish2018/pansou","slug":"pow-x","errorCode":null,"errorMessage":"PoW验证数据无效: x","messagePattern":"PoW验证数据无效: x","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/gying/gying.go","lineNumber":1745,"sourceCode":"\t}\n\n\tform := url.Values{}\n\tform.Set(\"action\", \"verify\")\n\tform.Set(\"id\", challenge.ID)\n\tform.Set(\"y\", y)\n\n\treturn p.submitChallengeVerification(scraper, requestURL, form)\n}\n\nfunc (p *GyingPlugin) computePowResult(challenge *ChallengePageData) (string, error) {\n\tmodulus, ok := new(big.Int).SetString(challenge.N, 16)\n\tif !ok || modulus.Sign() <= 0 {\n\t\treturn \"\", fmt.Errorf(\"PoW验证数据无效: N\")\n\t}\n\n\ty, ok := new(big.Int).SetString(challenge.X, 16)\n\tif !ok || y.Sign() < 0 {\n\t\treturn \"\", fmt.Errorf(\"PoW验证数据无效: x\")\n\t}\n\tif challenge.T <= 0 {\n\t\treturn \"\", fmt.Errorf(\"PoW验证数据无效: t\")\n\t}\n\n\tif DebugLog {\n\t\tfmt.Printf(\"[Gying] PoW Challenge计算开始: id=%s t=%d nBits=%d\\n\",\n\t\t\tchallenge.ID, challenge.T, modulus.BitLen())\n\t}\n\n\tstart := time.Now()\n\tfor i := 0; i < challenge.T; i++ {\n\t\ty.Mul(y, y)\n\t\ty.Mod(y, modulus)\n\t}\n\telapsed := time.Since(start)\n\n\tif DebugLog {","sourceCodeStart":1727,"sourceCodeEnd":1763,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/gying/gying.go#L1727-L1763","documentation":"computePowResult parses the challenge base x from hex via big.Int.SetString and requires it to be a non-negative integer. This error is returned when challenge.X is empty, not valid hex, or parses to a negative number, so the repeated-squaring y = x^(2^t) mod N cannot proceed.","triggerScenarios":"computePowResult is called with a ChallengePageData whose X field fails hex parsing or yields y.Sign() < 0 (e.g. X=\"\", X=\"zz\", or X=\"-a1\").","commonSituations":"Upstream changed the challenge JSON so the base is now decimal or base64-encoded instead of hex; the challenge body was truncated in transit; test fixtures with placeholder values are fed to the solver.","solutions":["Log challenge.X and the raw challenge response to see the actual value format","Re-fetch a fresh challenge; truncated/corrupted bodies are the typical cause","If the value is decimal or prefixed (0x), convert/strip before SetString(X, 16)","Pre-validate X client-side: non-empty hex, parses, value >= 0"],"exampleFix":"// before\ny, ok := new(big.Int).SetString(challenge.X, 16)\n// after\nxHex := strings.TrimPrefix(strings.ToLower(challenge.X), \"0x\")\ny, ok := new(big.Int).SetString(xHex, 16)\nif !ok || y.Sign() < 0 {\n    return \"\", fmt.Errorf(\"PoW验证数据无效: x\")\n}","handlingStrategy":"validation","validationCode":"func validHexNonNegative(s string) bool {\n    x, ok := new(big.Int).SetString(strings.TrimPrefix(s, \"0x\"), 16)\n    return ok && x.Sign() >= 0\n}\nif !validHexNonNegative(ch.X) { /* re-fetch challenge before solving */ }","typeGuard":"func isValidPowBase(c *ChallengePageData) bool {\n    x, ok := new(big.Int).SetString(c.X, 16)\n    return ok && x != nil && x.Sign() >= 0\n}","tryCatchPattern":"y, err := p.computePowResult(challenge)\nif err != nil {\n    if strings.Contains(err.Error(), \": x\") {\n        return p.refetchAndSolve(scraper, requestURL)\n    }\n    return err\n}","preventionTips":["Inspect the challenge JSON when a solver error occurs — base encoding changes (hex vs decimal) are common upstream drift","Strip optional 0x prefixes and lowercase hex before SetString","Validate all PoW fields (N, X, T) in one place after parsing the challenge"],"tags":["pow","challenge","hex-parsing","anti-bot"],"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"}