AlistGo/alist · error

not find file id

Error message

not find file id

What it means

While resolving a password-protected LanZou share, the driver could not extract the numeric file id from the share page HTML (findFileIDReg found no match), so it cannot build the /ajaxm.php?file=<id> request URL.

Source

Thrown at drivers/lanzou/util.go:402

	// 需要密码
	if strings.Contains(sharePageData, "pwdload") || strings.Contains(sharePageData, "passwddiv") {
		sharePageData, err := getJSFunctionByName(sharePageData, "down_p")
		if err != nil {
			return nil, err
		}
		param, err := htmlJsonToMap(sharePageData)
		if err != nil {
			return nil, err
		}
		param["p"] = pwd

		fileIDs := findFileIDReg.FindStringSubmatch(sharePageData)
		var fileID string
		if len(fileIDs) > 1 {
			fileID = fileIDs[1]
		} else {
			return nil, fmt.Errorf("not find file id")
		}
		var resp FileShareInfoAndUrlResp[string]
		_, err = d.post(d.ShareUrl+"/ajaxm.php?file="+fileID, func(req *resty.Request) { req.SetFormData(param) }, &resp)
		if err != nil {
			return nil, err
		}
		file.NameAll = resp.Inf
		file.Pwd = pwd
		baseUrl = resp.GetBaseUrl()
		downloadUrl = resp.GetDownloadUrl()
	} else {
		urlpaths := findDownPageParamReg.FindStringSubmatch(sharePageData)
		if len(urlpaths) != 2 {
			log.Errorf("lanzou: err => not find file page param ,data => %s\n", sharePageData)
			return nil, fmt.Errorf("not find file page param")
		}
		nextPageData, err := d.getHtml(fmt.Sprint(d.ShareUrl, urlpaths[1]), nil)
		if err != nil {

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Open the share URL in a browser and confirm it points to a downloadable file (not a folder listing) and still exists
  2. If it is a folder link, navigate to the specific file's share page and use that URL
  3. Retry with the correct password early, and update OpenList for parser fixes if the page structure changed
Defensive patterns

Strategy: validation

Validate before calling

// Ensure the link is a FILE share before the download flow
if !findFileIDReg.MatchString(sharePageData) && !looksLikeFilePage(sharePageData) {
    return nil, fmt.Errorf("link does not expose a file id (folder or deleted share?)")
}

Type guard

func hasLanzouFileID(html string) bool {
    return len(findFileIDReg.FindStringSubmatch(html)) > 1
}

Try / catch

if err := d.getFileLink(...); err != nil && strings.Contains(err.Error(), "not find file id") {
    return nil, fmt.Errorf("share URL is not a downloadable file link (deleted/folder?): %w", err)
}

Prevention

When it happens

Trigger: The share page variant returned for this link does not contain the expected JS fragment carrying the file id — e.g. a folder share treated as a file, a deleted link, a challenge page, or a template change.

Common situations: Using a folder share link where a file link is required (or vice versa); share deleted/made private; LanZou frontend update moving the id into a different script structure; password flow changed so the pre-password page differs.

Related errors


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