{"record":{"id":"e7c37e8222692644","repo":"fish2018/pansou","slug":"pow-t","errorCode":null,"errorMessage":"PoW验证数据无效: t","messagePattern":"PoW验证数据无效: t","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/gying/gying.go","lineNumber":1748,"sourceCode":"\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 {\n\t\tfmt.Printf(\"[Gying] PoW Challenge计算完成: id=%s t=%d cost=%s\\n\",\n\t\t\tchallenge.ID, challenge.T, elapsed.Round(time.Millisecond))\n\t}","sourceCodeStart":1730,"sourceCodeEnd":1766,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/gying/gying.go#L1730-L1766","documentation":"computePowResult requires challenge.T (the number of squaring iterations) to be strictly positive. This error is returned when T is zero or negative, which would make the PoW loop a no-op or invalid and mean the server did not issue a meaningful work factor.","triggerScenarios":"computePowResult is called with a ChallengePageData whose T field is 0 or negative (missing/zero-valued in the JSON response).","commonSituations":"The site's challenge endpoint changed field names so t is no longer unmarshaled; a degraded/empty challenge response was parsed without error because the struct's zero values pass the caller's earlier check only partially; stale cached challenge structs reused after reset.","solutions":["Log challenge.T and the raw JSON body to confirm the difficulty field is present under the expected key","Re-fetch a fresh challenge from /res/pow","Update ChallengePageData's JSON tag mapping if the upstream renamed the t field","Pre-validate T > 0 in the caller before invoking the solver"],"exampleFix":"// before\nif challenge.T <= 0 {\n    return \"\", fmt.Errorf(\"PoW验证数据无效: t\")\n}\n// after (validate at fetch site)\nif challenge.N == \"\" || challenge.X == \"\" || challenge.T <= 0 {\n    return fmt.Errorf(\"PoW验证数据无效\")\n}","handlingStrategy":"validation","validationCode":"if ch.T <= 0 { /* treat challenge as invalid; re-fetch from /res/pow */ }","typeGuard":"func hasPositiveWorkFactor(c *ChallengePageData) bool { return c.T > 0 }","tryCatchPattern":"y, err := p.computePowResult(challenge)\nif err != nil {\n    if strings.Contains(err.Error(), \": t\") {\n        return p.refetchAndSolve(scraper, requestURL)\n    }\n    return err\n}","preventionTips":["Keep ChallengePageData JSON tags in sync with the site's current challenge schema","Treat a zero-valued T as a sign the challenge did not parse as expected; log the raw body","Re-fetch challenges instead of reusing structs whose fields may have been zeroed"],"tags":["pow","challenge","difficulty","anti-bot"],"backgroundTag":"invalid-argument-value","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"}