{"record":{"id":"e4182f454eb3058e","repo":"AlistGo/alist","slug":"code","errorCode":null,"errorMessage":"code","messagePattern":"code","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/vtencent/util.go","lineNumber":50,"sourceCode":"\t})\n\tif callback != nil {\n\t\tcallback(req)\n\t} else {\n\t\treq.SetBody(\"{}\")\n\t}\n\tif resp != nil {\n\t\treq.SetResult(resp)\n\t}\n\tres, err := req.Execute(method, url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcode := utils.Json.Get(res.Body(), \"Code\").ToString()\n\tif code != \"Success\" {\n\t\tswitch code {\n\t\tcase \"AuthFailure.SessionInvalid\":\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.New(code)\n\t\t\t}\n\t\tdefault:\n\t\t\treturn nil, errors.New(code)\n\t\t}\n\t\treturn d.request(url, method, callback, resp)\n\t}\n\treturn res.Body(), nil\n}\n\nfunc (d *Vtencent) ugcRequest(url, method string, callback base.ReqCallback, resp interface{}) ([]byte, error) {\n\treq := base.RestyClient.R()\n\treq.SetHeaders(map[string]string{\n\t\t\"cookie\":       d.Cookie,\n\t\t\"content-type\": \"application/json\",\n\t\t\"origin\":       d.conf.origin,\n\t\t\"referer\":      d.conf.referer,\n\t})\n\tif callback != nil {","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/vtencent/util.go#L32-L68","documentation":"The vtencent driver's request() reads the JSON field Code from every response and expects \"Success\"; any other value becomes errors.New(code) — the error message is the raw API error code string itself (this entry is the default branch, e.g. 'AuthFailure.SignatureExpire', 'InvalidParameter'). Tencent Cloud VOD/INS API error codes are the only diagnostic the driver surfaces, without the accompanying message field.","triggerScenarios":"Any signed Tencent Cloud API call (DescribeAccount, media APIs) returning Code != \"Success\" — expired signature (clock skew), invalid SecretId/SecretKey, missing CAM permission for the action, or malformed parameters. The switch on 'AuthFailure.SessionInvalid' here contains a dead `if err != nil` check (err is always nil at that point) so session-invalid falls through to the recursive retry on line 55 instead of returning here.","commonSituations":"Wrong or rotated Tencent Cloud API credentials in the storage config; Server clock skew breaking the signature (AuthFailure.SignatureExpire); IAM/CAM principal lacking vod/ins permissions; Region mismatch causing invalid-endpoint style codes","solutions":["Verify SecretId/SecretKey in storage settings and re-save to re-run Init","Check server time (ntp) if the code is AuthFailure.Signature*","Grant the CAM principal the required VOD/INS permissions and retry","Search the exact code string in Tencent Cloud API docs (Error Codes section) for the authoritative cause"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// validate credentials before mounting\nif _, err := vt.LoadUser(); err != nil {\n    return fmt.Errorf(\"vtencent credentials invalid: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"body, err := d.request(api, method, cb, resp)\nif err != nil {\n    code := err.Error()\n    switch {\n    case strings.HasPrefix(code, \"AuthFailure.Signature\"):\n        // sync clock / check server time, then retry once\n    case code == \"AuthFailure.SecretIdNotFound\" || code == \"AuthFailure.SignatureFailure\":\n        // credentials wrong: stop and prompt reconfiguration\n    case strings.HasPrefix(code, \"AuthFailure\"): // other authz failures\n        // check CAM permissions for the action\n    default:\n        return fmt.Errorf(\"tencent api %s: %s\", api, code)\n    }\n}","preventionTips":["Map Tencent error-code prefixes to recovery actions (signature->clock, SecretIdNotFound->credentials, UnauthorizedOperation->CAM)","Run a cheap DescribeAccount call at Init to fail fast on bad credentials","Keep server time NTP-synced to avoid signature expiry errors"],"tags":["vtencent","tencent-cloud","api-error","auth","signature"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}