{"record":{"id":"d962c7c4b86e6116","repo":"AlistGo/alist","slug":"empty-files-are-not-allowed-by-baidu-youth","errorCode":null,"errorMessage":"empty files are not allowed by baidu youth","messagePattern":"empty files are not allowed by baidu youth","errorType":"exception","errorClass":"ErrBaiduYouthEmptyFilesNotAllowed","httpStatus":null,"severity":"warning","filePath":"drivers/baidu_youth/types.go","lineNumber":14,"sourceCode":"package baidu_youth\n\nimport (\n\t\"errors\"\n\t\"path\"\n\t\"strconv\"\n\t\"time\"\n\n\t\"github.com/alist-org/alist/v3/internal/model\"\n\t\"github.com/alist-org/alist/v3/pkg/utils\"\n)\n\nvar (\n\tErrBaiduYouthEmptyFilesNotAllowed = errors.New(\"empty files are not allowed by baidu youth\")\n)\n\ntype File struct {\n\tCategory int   `json:\"category\"`\n\tFsId     int64 `json:\"fs_id\"`\n\tThumbs   struct {\n\t\tUrl3 string `json:\"url3\"`\n\t} `json:\"thumbs\"`\n\tSize           int64  `json:\"size\"`\n\tPath           string `json:\"path\"`\n\tServerFilename string `json:\"server_filename\"`\n\tMd5            string `json:\"md5\"`\n\tIsdir          int    `json:\"isdir\"`\n\tServerCtime    int64  `json:\"server_ctime\"`\n\tServerMtime    int64  `json:\"server_mtime\"`\n\tLocalMtime     int64  `json:\"local_mtime\"`\n\tLocalCtime     int64  `json:\"local_ctime\"`\n\tCtime          int64  `json:\"ctime\"`","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/baidu_youth/types.go#L1-L32","documentation":"Sentinel error ErrBaiduYouthEmptyFilesNotAllowed declared in drivers/baidu_youth/types.go. The Baidu Youth (青春版) netdisk variant likewise rejects zero-byte files, and the driver surfaces this dedicated error when an empty upload is attempted.","triggerScenarios":"Calling Put() on a Baidu Youth storage with a model.FileStreamer of size 0; the server-side API refuses empty file creation.","commonSituations":"Same as the main netdisk driver: syncing placeholder files, .gitkeep markers, or empty logs to a Youth edition account.","solutions":["Skip zero-byte files in your upload/sync job targeting Baidu Youth","Write a 1-byte placeholder if an entry must exist","Handle this sentinel (errors.Is) as a skippable condition in batch transfers"],"exampleFix":"// before\nerr := d.Put(ctx, dst, stream)\n// after\nif stream.GetSize() == 0 {\n    return errs.NotImplement // or skip upstream\n}","handlingStrategy":"validation","validationCode":"if stream.GetSize() == 0 { return nil }","typeGuard":null,"tryCatchPattern":"err := d.Put(ctx, dst, stream, up)\nif err != nil && errors.Is(err, ErrBaiduYouthEmptyFilesNotAllowed) { return nil }","preventionTips":["Skip empty files for Baidu Youth targets","Compare with errors.Is on the package sentinel","Batch tools should classify this as skippable, not fatal"],"tags":["baidu-youth","upload","empty-file"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}