{"record":{"id":"e14be31290102961","repo":"AlistGo/alist","slug":"e-description","errorCode":null,"errorMessage":"e.Description","messagePattern":"e\\.Description","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/yandex_disk/util.go","lineNumber":62,"sourceCode":"\tif resp != nil {\n\t\treq.SetResult(resp)\n\t}\n\tvar e ErrResp\n\treq.SetError(&e)\n\tres, err := req.Execute(method, u)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t//log.Debug(res.String())\n\tif e.Error != \"\" {\n\t\tif e.Error == \"UnauthorizedError\" {\n\t\t\terr = d.refreshToken()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn d.request(pathname, method, callback, resp)\n\t\t}\n\t\treturn nil, errors.New(e.Description)\n\t}\n\treturn res.Body(), nil\n}\n\nfunc (d *YandexDisk) getFiles(path string) ([]File, error) {\n\tlimit := 100\n\tpage := 1\n\tres := make([]File, 0)\n\tfor {\n\t\toffset := (page - 1) * limit\n\t\tquery := map[string]string{\n\t\t\t\"path\":   path,\n\t\t\t\"limit\":  strconv.Itoa(limit),\n\t\t\t\"offset\": strconv.Itoa(offset),\n\t\t}\n\t\tif d.OrderBy != \"\" {\n\t\t\tif d.OrderDirection == \"desc\" {\n\t\t\t\tquery[\"sort\"] = \"-\" + d.OrderBy","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/yandex_disk/util.go#L44-L80","documentation":"The Yandex Disk driver surfaces the upstream API's error description verbatim: the HTTP response body parsed to an ApiError with a non-empty Error code that is not \"UnauthorizedError\". Whatever text Yandex returns in the Description field (e.g. \"Couldn't find disk object\" for DiskNotFoundError, quota messages for DiskResourceAlreadyExistsError) becomes the Go error. The literal message \"e.Description\" in logs means the error string itself came from the remote API.","triggerScenarios":"Any Yandex Disk REST call whose response body is {\"error\": \"<code>\", \"description\": \"...\"} with a code other than UnauthorizedError — 404 on missing path (DiskNotFoundError), 409 on existing folder (DiskResourceAlreadyExistsError), 400 bad parameters, 503 maintenance, rate limiting.","commonSituations":"Listing or linking a deleted/moved path; MakeDir on an existing name; expired OAuth token when the code isn't the unauthorized variant; Yandex API rate limits or maintenance windows; malformed path (leading/trailing slashes).","solutions":["Read the description text — it names the exact upstream cause (not-found, already-exists, quota, rate limit)","For not-found: refresh the listing; the path was deleted, moved, or shared-permissions changed","For rate-limit/maintenance descriptions: back off and retry with exponential delay","If auth-related, re-run the OAuth flow so refreshToken() can succeed on the next 401"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"res, err := d.request(path, method, callback, &resp)\nif err != nil {\n    msg := err.Error()\n    switch {\n    case strings.Contains(msg, \"couldn't find\"): // DiskNotFoundError\n        // refresh listing / treat as deleted\n    case strings.Contains(msg, \"already exists\"): // 409\n        // MakeDir idempotency: treat as success\n    case strings.Contains(msg, \"too many requests\"):\n        time.Sleep(time.Duration(rand.Intn(30)) * time.Second)\n        return d.request(path, method, callback, resp) // backoff retry\n    }\n    return nil, err\n}","preventionTips":["Treat the error text as the upstream code's description and map known descriptions to recovery actions","Refresh OAuth tokens proactively so UnauthorizedError handling stays effective","Make MakeDir idempotent: map already-exists descriptions to success","Back off on rate-limit descriptions instead of hammering"],"tags":["yandex-disk","driver","api-error","upstream","propagated"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}