{"record":{"id":"90dc32dc90b4f99d","repo":"AlistGo/alist","slug":"no-download-url-available-for-file-s","errorCode":null,"errorMessage":"no download URL available for file %s","messagePattern":"no download URL available for file (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/darkibox/driver.go","lineNumber":146,"sourceCode":"\tif err := d.callAPI(ctx, \"/file/direct_link\", map[string]string{\n\t\t\"file_code\": fileCode,\n\t}, &result); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get direct link: %w\", err)\n\t}\n\n\t// Find the original quality version, fall back to first available\n\tvar dlURL string\n\tfor _, v := range result.Versions {\n\t\tif v.Name == \"o\" {\n\t\t\tdlURL = v.URL\n\t\t\tbreak\n\t\t}\n\t}\n\tif dlURL == \"\" && len(result.Versions) > 0 {\n\t\tdlURL = result.Versions[0].URL\n\t}\n\tif dlURL == \"\" {\n\t\treturn nil, fmt.Errorf(\"no download URL available for file %s\", fileCode)\n\t}\n\n\treturn &model.Link{\n\t\tURL: dlURL,\n\t}, nil\n}\n\nfunc (d *Darkibox) MakeDir(ctx context.Context, parentDir model.Obj, dirName string) (model.Obj, error) {\n\tparentID := d.RootFolderID\n\tif parentDir.GetID() != \"\" {\n\t\tparentID = folderIDFromObjID(parentDir.GetID())\n\t}\n\n\tvar result folderCreateResult\n\tif err := d.callAPI(ctx, \"/folder/create\", map[string]string{\n\t\t\"name\":      dirName,\n\t\t\"parent_id\": fldIDStr(parentID),\n\t}, &result); err != nil {","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/darkibox/driver.go#L128-L164","documentation":"Returned by Darkibox.Link when the direct_link API call succeeded but the response contained no usable URL: neither a version named 'o' (original quality) nor any entry in result.Versions had a non-empty URL. This is a data-shape problem — the API said success but the payload cannot be turned into a download link, so Link fails rather than returning an empty URL that would break the client later.","triggerScenarios":"Downloading a file whose direct_link response returns an empty versions array, versions with blank URLs, or a changed response schema where the URLs now live in a different field so the loop finds nothing. Also possible when the provider returns a success status but the file is still processing server-side and no rendition is ready.","commonSituations":"Provider API change moving/renaming the versions payload; freshly uploaded file not yet processed on Darkibox's side; account-tier restrictions returning an empty set; encoding variants present but with empty URL fields.","solutions":["Retry after a short wait — files still processing server-side often gain URLs moments later","Refresh the listing and retry the download to rule out stale file state","Inspect the raw direct_link response (curl with the same file_code) — if URLs now live in another field or format, the driver needs updating to the current API schema","If the account lacks download rights for that quality, verify account status on Darkibox"],"exampleFix":"# inspect actual response shape\ncurl 'https://darkibox.com/api/file/direct_link?key=KEY&file_code=CODE'\n# if versions moved, driver loop over result.Versions must be updated to the new field","handlingStrategy":"type-guard","validationCode":"// After a successful direct_link call, inspect versions before trusting them\nif len(result.Versions) == 0 {\n    return errors.New(\"no versions in direct_link response; file may still be processing\")\n}","typeGuard":"func hasUsableDownloadURL(result *directLinkResult) bool {\n    for _, v := range result.Versions {\n        if v.URL != \"\" { return true }\n    }\n    return false\n}","tryCatchPattern":"link, err := d.Link(ctx, file, args)\nif err != nil && strings.Contains(err.Error(), \"no download URL available\") {\n    // often transient while provider processes the file; wait once, then refresh listing\n    time.Sleep(5 * time.Second)\n    link, err = d.Link(ctx, file, args)\n    if err != nil { return nil, fmt.Errorf(\"darkibox returned no usable URL for %s: %w\", file.GetID(), err) }\n}","preventionTips":["Retry shortly after upload — renditions may not be ready immediately","Inspect raw direct_link responses when integrating, so schema changes are caught early","Verify account download permissions when versions come back systematically empty","Cache successful URLs briefly to avoid re-hitting direct_link for repeat downloads"],"tags":["darkibox","download","api-response","data-shape"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}