AlistGo/alist · error

no download URL available for file %s

Error message

no download URL available for file %s

What it means

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.

Source

Thrown at drivers/darkibox/driver.go:146

	if err := d.callAPI(ctx, "/file/direct_link", map[string]string{
		"file_code": fileCode,
	}, &result); err != nil {
		return nil, fmt.Errorf("failed to get direct link: %w", err)
	}

	// Find the original quality version, fall back to first available
	var dlURL string
	for _, v := range result.Versions {
		if v.Name == "o" {
			dlURL = v.URL
			break
		}
	}
	if dlURL == "" && len(result.Versions) > 0 {
		dlURL = result.Versions[0].URL
	}
	if dlURL == "" {
		return nil, fmt.Errorf("no download URL available for file %s", fileCode)
	}

	return &model.Link{
		URL: dlURL,
	}, nil
}

func (d *Darkibox) MakeDir(ctx context.Context, parentDir model.Obj, dirName string) (model.Obj, error) {
	parentID := d.RootFolderID
	if parentDir.GetID() != "" {
		parentID = folderIDFromObjID(parentDir.GetID())
	}

	var result folderCreateResult
	if err := d.callAPI(ctx, "/folder/create", map[string]string{
		"name":      dirName,
		"parent_id": fldIDStr(parentID),
	}, &result); err != nil {

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Retry after a short wait — files still processing server-side often gain URLs moments later
  2. Refresh the listing and retry the download to rule out stale file state
  3. 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
  4. If the account lacks download rights for that quality, verify account status on Darkibox

Example fix

# inspect actual response shape
curl 'https://darkibox.com/api/file/direct_link?key=KEY&file_code=CODE'
# if versions moved, driver loop over result.Versions must be updated to the new field
Defensive patterns

Strategy: type-guard

Validate before calling

// After a successful direct_link call, inspect versions before trusting them
if len(result.Versions) == 0 {
    return errors.New("no versions in direct_link response; file may still be processing")
}

Type guard

func hasUsableDownloadURL(result *directLinkResult) bool {
    for _, v := range result.Versions {
        if v.URL != "" { return true }
    }
    return false
}

Try / catch

link, err := d.Link(ctx, file, args)
if err != nil && strings.Contains(err.Error(), "no download URL available") {
    // often transient while provider processes the file; wait once, then refresh listing
    time.Sleep(5 * time.Second)
    link, err = d.Link(ctx, file, args)
    if err != nil { return nil, fmt.Errorf("darkibox returned no usable URL for %s: %w", file.GetID(), err) }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15). Data as JSON: /api/errors/90dc32dc90b4f99d. Report an issue: GitHub.