{"record":{"id":"02923298048c078c","repo":"AlistGo/alist","slug":"resolve-offline-resource-failed-s","errorCode":null,"errorMessage":"resolve offline resource failed: %s","messagePattern":"resolve offline resource failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/guangyapan/offline.go","lineNumber":30,"sourceCode":")\n\nfunc (d *GuangYaPan) ResolveOfflineResource(ctx context.Context, fileURL string) (*OfflineResolveData, error) {\n\tif err := d.ensureAccessToken(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\tfileURL = strings.TrimSpace(fileURL)\n\tif fileURL == \"\" {\n\t\treturn nil, errors.New(\"offline url is empty\")\n\t}\n\n\tvar resp offlineResolveResp\n\tif err := d.postAPI(ctx, \"/cloudcollection/v1/resolve_res\", map[string]any{\n\t\t\"url\": fileURL,\n\t}, &resp); err != nil {\n\t\treturn nil, err\n\t}\n\tif !isSuccessMsg(resp.Msg) {\n\t\treturn nil, fmt.Errorf(\"resolve offline resource failed: %s\", strings.TrimSpace(resp.Msg))\n\t}\n\treturn &resp.Data, nil\n}\n\nfunc (d *GuangYaPan) OfflineDownload(ctx context.Context, fileURL string, parentDir model.Obj, fileName string) (*OfflineTask, error) {\n\tresolved, err := d.ResolveOfflineResource(ctx, fileURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tparentID := parentDir.GetID()\n\trootID, err := d.getRootFolderID(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif parentID == rootID {\n\t\tparentID = \"\"\n\t}","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/guangyapan/offline.go#L12-L48","documentation":"ResolveOfflineResource POSTs the user-supplied URL to /cloudcollection/v1/resolve_res and throws when the envelope Msg is not 'success'. Resolution is the provider's URL analysis step (magnet/HTTP link inspection) before an offline task can be created; failure means the provider could not or would not analyze the link.","triggerScenarios":"OfflineDownload called with a dead 404 link, unsupported protocol, malformed magnet URI, geo-blocked or auth-walled URL, or when the resolver service is down.","commonSituations":"Magnet links with no seeders that fail analysis; URLs requiring login (private buckets); provider suspended the resolve service; link pasted with surrounding whitespace/quotes (though basic trim happens).","solutions":["Test the URL in a browser/downloader to confirm it is reachable and public.","Use a different mirror or a healthy magnet for the same content.","Retry later if the provider's offline service is flaky."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// validate the link before calling OfflineDownload\nu := strings.TrimSpace(fileURL)\nif u == \"\" { return errors.New(\"empty offline url\") }\nif !strings.HasPrefix(u, \"http://\") && !strings.HasPrefix(u, \"https://\") && !strings.HasPrefix(u, \"magnet:\") {\n    return fmt.Errorf(\"unsupported offline url scheme: %q\", u)\n}","typeGuard":null,"tryCatchPattern":"if _, err := d.OfflineDownload(ctx, fileURL, parentDir, fileName); err != nil {\n    if strings.Contains(err.Error(), \"resolve offline resource failed\") {\n        // link itself is bad: do not retry; ask user for a valid URL\n        return fmt.Errorf(\"link could not be resolved (dead/unsupported/private): %w\", err)\n    }\n    return err\n}","preventionTips":["Pre-validate URL scheme and non-emptiness client-side.","Test links externally before queueing offline downloads.","Avoid auth-walled or geo-blocked URLs."],"tags":["offline-download","url-validation","guangyapan"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}