{"record":{"id":"e4b40dcae5baeb3d","repo":"AlistGo/alist","slug":"file-sharing-cancellation","errorCode":null,"errorMessage":"file sharing cancellation","messagePattern":"file sharing cancellation","errorType":"exception","errorClass":"ErrFileShareCancel","httpStatus":null,"severity":"error","filePath":"drivers/lanzou/types.go","lineNumber":11,"sourceCode":"package lanzou\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"github.com/alist-org/alist/v3/internal/model\"\n\t\"github.com/alist-org/alist/v3/pkg/utils\"\n\t\"time\"\n)\n\nvar ErrFileShareCancel = errors.New(\"file sharing cancellation\")\nvar ErrFileNotExist = errors.New(\"file does not exist\")\nvar ErrCookieExpiration = errors.New(\"cookie expiration\")\n\ntype RespText[T any] struct {\n\tText T `json:\"text\"`\n}\n\ntype RespInfo[T any] struct {\n\tInfo T `json:\"info\"`\n}\n\nvar _ model.Obj = (*FileOrFolder)(nil)\nvar _ model.Obj = (*FileOrFolderByShareUrl)(nil)\n\ntype FileOrFolder struct {\n\tName string `json:\"name\"`\n\t//Onof        string `json:\"onof\"` // 是否存在提取码\n\t//IsLock      string `json:\"is_lock\"`","sourceCodeStart":1,"sourceCodeEnd":29,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/lanzou/types.go#L1-L29","documentation":"Sentinel error ErrFileShareCancel in the lanzou driver. It is produced in getShareUrlHtml (util.go:329-331) when the fetched share page HTML contains the literal text \"取消分享\" (share cancelled). The owner of the lanzou share link deleted or cancelled the share, so no scraping flow can proceed.","triggerScenarios":"GET {ShareUrl}/{shareID} returns the page whose body contains 取消分享 — the file owner cancelled sharing, the share was reported/removed by lanzou moderation, or the share expired. Compare via err == ErrFileShareCancel or errors.Is.","commonSituations":"User bookmarked a lanzou share that the uploader later deleted; content takedown; share link pasted wrong so it lands on a cancelled-share page.","solutions":["Match this sentinel with errors.Is and surface 'share was cancelled by the owner' to the user instead of a generic failure","Remove/disable the affected mount or link source since retrying cannot recover a cancelled share","If you own the share, re-share the file on woozooo.com to get a fresh shareID"],"exampleFix":"// before\nfiles, err := d.GetFileOrFolderByShareUrl(shareID, pwd)\nif err != nil { return err }\n// after\nfiles, err := d.GetFileOrFolderByShareUrl(shareID, pwd)\nswitch {\ncase errors.Is(err, lanzou.ErrFileShareCancel):\n\treturn fmt.Errorf(\"share %s was cancelled by its owner\", shareID)\ncase errors.Is(err, lanzou.ErrFileNotExist):\n\treturn fmt.Errorf(\"share %s no longer exists\", shareID)\ncase err != nil:\n\treturn err\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"func isShareCancelled(err error) bool { return errors.Is(err, lanzou.ErrFileShareCancel) }","tryCatchPattern":"files, err := d.GetFileOrFolderByShareUrl(shareID, pwd)\nif err != nil {\n\tif errors.Is(err, lanzou.ErrFileShareCancel) {\n\t\t// permanent: stop retrying, notify user\n\t\treturn nil, fmt.Errorf(\"share %s cancelled by owner\", shareID)\n\t}\n\treturn nil, err\n}","preventionTips":["Always match lanzou sentinels with errors.Is, never string comparison","Classify this error as permanent in retry policies — no backoff will revive a cancelled share"],"tags":["lanzou","share-link","sentinel-error","driver","go"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}