{"record":{"id":"88caa99b3c564ff1","repo":"AlistGo/alist","slug":"baseresp-errmsg","errorCode":null,"errorMessage":"baseResp.Errmsg","messagePattern":"baseResp\\.Errmsg","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/yunpan360/util.go","lineNumber":82,"sourceCode":"\t\t\t\"Referer\":          baseURL + \"/file/index\",\n\t\t\t\"X-Requested-With\": \"XMLHttpRequest\",\n\t\t}).\n\t\tSetFormData(form)\n\n\tres, err := req.Execute(http.MethodPost, baseURL+apiPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar baseResp BaseResp\n\tif err := utils.Json.Unmarshal(res.Body(), &baseResp); err != nil {\n\t\treturn err\n\t}\n\tif baseResp.Errno != 0 {\n\t\tif baseResp.Errmsg == \"\" {\n\t\t\treturn fmt.Errorf(\"yunpan request failed: errno=%d\", baseResp.Errno)\n\t\t}\n\t\treturn errors.New(baseResp.Errmsg)\n\t}\n\tif out == nil {\n\t\treturn nil\n\t}\n\treturn utils.Json.Unmarshal(res.Body(), out)\n}\n\nfunc requestPath(dirPath string) string {\n\tpath := normalizeRemotePath(dirPath)\n\tif path == \"\" {\n\t\treturn \"/\"\n\t}\n\treturn path\n}\n\nfunc requestOrder(order string) string {\n\tif strings.EqualFold(order, \"desc\") {\n\t\treturn \"desc\"","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/yunpan360/util.go#L64-L100","documentation":"Returned by the yunpan360 driver when a cookie-mode API call succeeds at the HTTP level but the response body carries a non-zero Errno in its BaseResp envelope. The server-supplied Errmsg string is propagated verbatim as the error text. This is the canonical 'business-level failure' signal for 360 Cloud Drive (yunpan) endpoints.","triggerScenarios":"Any d.cookieRequestForm / cookie-mode request whose JSON response decodes into BaseResp with Errno != 0 and a non-empty Errmsg field (drivers/yunpan360/util.go:82). Typical triggers: listing or downloading files with an expired or invalid cookie session, operating on a file that was deleted server-side, or hitting rate limits / login-state checks on yunpan360.com.","commonSituations":"Cookie credentials expired (user logged out or cookie rotated) while the driver still sends requests; wrong cookie configuration in the storage settings; files renamed or moved externally so the nid/path the driver holds is stale; 360 backend returning session-relogin errors after long idle periods.","solutions":["Refresh or re-enter the cookie/credentials in the storage configuration and retry the request","Verify the request targets an object that still exists (re-list the parent directory to get fresh nid/path)","Inspect the Errmsg text and the accompanying errno value — it is the server's own reason (e.g. relogin required, file not found) and maps directly to the fix","If errors persist for every call, log out and back in on yunpan360.com to obtain a fresh cookie, then update the driver config"],"exampleFix":"// before: error text is opaque server message\nreturn errors.New(baseResp.Errmsg)\n\n// after: wrap with errno for easier diagnosis\nreturn fmt.Errorf(\"yunpan request failed: errno=%d: %s\", baseResp.Errno, baseResp.Errmsg)","handlingStrategy":"retry","validationCode":"if d.Addition.Cookie == \"\" { return errs.EmptyToken } // ensure session configured before cookie calls","typeGuard":"func isYunpanBusinessErr(err error) bool { return err != nil && !errors.Is(err, io.EOF) && strings.Contains(err.Error(), \"errno=\") || /* server msg */ yunpanErrno(err) > 0 }","tryCatchPattern":"resp, err := d.cookieRequestForm(ctx, path, form, out)\nif err != nil {\n    if strings.Contains(err.Error(), \"relogin\") || isSessionExpired(err) {\n        d.invalidateCookieSession()\n        resp, err = d.cookieRequestForm(ctx, path, form, out)\n    }\n}","preventionTips":["Keep cookie credentials fresh; refresh proactively before expiry","Always operate on objects from a recent List() so nid/path are current","Log errno values server-side to classify failures quickly"],"tags":["yunpan360","api","cookie","go","driver"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}