AlistGo/alist · error · ErrFileNotExist

file does not exist

Error message

file does not exist

What it means

Sentinel error ErrFileNotExist in the lanzou driver, set in getShareUrlHtml (util.go:332-334) when the share page HTML contains "文件不存在" (file does not exist). The shareID is valid syntactically but the target file is gone — deleted by the owner before or after sharing. Downstream code (e.g. refresh flows) uses errors.Is on this sentinel to decide whether to drop cached objects.

Solutions

  1. Handle with errors.Is(err, ErrFileNotExist) and report a 404-style message; drop the object from any local cache
  2. Ask the owner for the new share link if the content was re-uploaded
  3. Double-check the shareID/URL for typos or truncated copy-paste
Defensive patterns

Strategy: try-catch

Type guard

func isFileNotExist(err error) bool { return errors.Is(err, lanzou.ErrFileNotExist) }

Try / catch

if err != nil {
	if errors.Is(err, lanzou.ErrFileNotExist) {
		// drop from cache, return a 404-equivalent
		cache.Delete(shareID)
		return nil, errs.ObjectNotFound
	}
	return nil, err
}

Prevention

When it happens

Trigger: GET {ShareUrl}/{shareID} page body contains 文件不存在: file deleted from the uploader's lanzou account, wrong shareID typed/pasted, or the share was purged after a takedown.

Common situations: Stale cached alist link pointing at a removed file; user typo in shareID; uploader re-uploaded under a new link.

Related errors


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

Appendix: source

Thrown at drivers/lanzou/types.go:12

package lanzou

import (
	"errors"
	"fmt"
	"github.com/alist-org/alist/v3/internal/model"
	"github.com/alist-org/alist/v3/pkg/utils"
	"time"
)

var ErrFileShareCancel = errors.New("file sharing cancellation")
var ErrFileNotExist = errors.New("file does not exist")
var ErrCookieExpiration = errors.New("cookie expiration")

type RespText[T any] struct {
	Text T `json:"text"`
}

type RespInfo[T any] struct {
	Info T `json:"info"`
}

var _ model.Obj = (*FileOrFolder)(nil)
var _ model.Obj = (*FileOrFolderByShareUrl)(nil)

type FileOrFolder struct {
	Name string `json:"name"`
	//Onof        string `json:"onof"` // 是否存在提取码
	//IsLock      string `json:"is_lock"`
	//IsCopyright int    `json:"is_copyright"`

View on GitHub (pinned to 843d9dc814)