{"record":{"id":"d32a7048c600aa10","repo":"AlistGo/alist","slug":"doubao-api-error-code-d-s-d32a70","errorCode":null,"errorMessage":"[doubao] API error (code: %d): %s","messagePattern":"\\[doubao\\] API error \\(code: (.+?)\\): (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/doubao_share/types.go","lineNumber":193,"sourceCode":"\treturn r.Code == 0\n}\n\n// GetError 获取错误信息\nfunc (r *CommonResp) GetError() error {\n\tif r.IsSuccess() {\n\t\treturn nil\n\t}\n\t// 优先使用message字段\n\terrMsg := r.Message\n\tif errMsg == \"\" {\n\t\terrMsg = r.Msg\n\t}\n\t// 如果error对象存在且有详细消息,则使用error中的信息\n\tif r.Error != nil && r.Error.Message != \"\" {\n\t\terrMsg = r.Error.Message\n\t}\n\n\treturn fmt.Errorf(\"[doubao] API error (code: %d): %s\", r.Code, errMsg)\n}\n\n// UnmarshalData 将data字段解析为指定类型\nfunc (r *CommonResp) UnmarshalData(v interface{}) error {\n\tif !r.IsSuccess() {\n\t\treturn r.GetError()\n\t}\n\n\tif len(r.Data) == 0 {\n\t\treturn nil\n\t}\n\n\treturn json.Unmarshal(r.Data, v)\n}\n","sourceCodeStart":175,"sourceCodeEnd":208,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/doubao_share/types.go#L175-L208","documentation":"CommonResp.GetError in the doubao_share driver converts any non-zero business code from a Doubao share API response into an error, preferring the message field, then msg, then the nested error.message. The code and text after the colon come straight from the server and identify the real problem (expired share, invalid token, rate limit, etc.).","triggerScenarios":"Any doubao_share API call (share overview, file list, get share info) whose envelope has code != 0: share link expired or revoked, wrong share_id format, visitor token not obtained/refreshed, rate limiting, or an authenticated endpoint hit without credentials.","commonSituations":"The shared link's passcode/availability changed after the mount was configured; long-running mounts whose share access token timed out; typo'd share_id in the share_ids config; Doubao tightening access to the share API.","solutions":["Match the code/message: expiry-related messages mean re-open the share in a browser and update share_ids; auth messages mean refresh the driver's cookies/token.","Verify the share_id value and the share's availability (not deleted/password-protected) in a browser.","Retry after backoff if the message indicates rate limiting.","Update the driver binary — share API contract changes are typically fixed in newer releases."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"func isDoubaoShareAPIError(err error) bool {\n    return err != nil && strings.Contains(err.Error(), \"[doubao] API error (code:\")\n}","tryCatchPattern":"files, err := d.getShareOverview(shareId, \"\")\nif err != nil {\n    if isDoubaoShareAPIError(err) {\n        msg := err.Error()\n        switch {\n        case strings.Contains(msg, \"expired\") || strings.Contains(msg, \"cancel\"):\n            // share dead: surface config error, stop retrying\n        case strings.Contains(msg, \"frequency\") || strings.Contains(msg, \"rate\"):\n            time.Sleep(5 * time.Second) // then retry once\n        default:\n            return err\n        }\n    }\n    return err\n}","preventionTips":["Verify share links periodically (they expire).","Refresh the mount's cookies/tokens when auth-coded messages appear.","Cache listings to reduce API calls and rate-limit exposure."],"tags":["doubao-share","api-error","share-link"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}