{"record":{"id":"cbc0a6843776dfe4","repo":"AlistGo/alist","slug":"doubao-new-upload-v3-block-empty-data","errorCode":null,"errorMessage":"[doubao_new] upload v3 block empty data","messagePattern":"\\[doubao_new\\] upload v3 block empty data","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/doubao_new/util.go","lineNumber":827,"sourceCode":"\t\terrMsg := resp.Msg\n\t\tif errMsg == \"\" {\n\t\t\terrMsg = resp.Message\n\t\t}\n\t\treturn UploadMergeData{}, fmt.Errorf(\"[doubao_new] API error (code: %d): %s\", resp.Code, errMsg)\n\t}\n\n\treturn resp.Data, nil\n}\n\nfunc (d *DoubaoNew) uploadBlockV3(ctx context.Context, uploadID string, block UploadBlockNeed, data []byte) error {\n\tif uploadID == \"\" {\n\t\treturn fmt.Errorf(\"[doubao_new] upload v3 block missing upload_id\")\n\t}\n\tif block.Seq < 0 {\n\t\treturn fmt.Errorf(\"[doubao_new] upload v3 block invalid seq\")\n\t}\n\tif len(data) == 0 {\n\t\treturn fmt.Errorf(\"[doubao_new] upload v3 block empty data\")\n\t}\n\n\treq := base.RestyClient.R()\n\treq.SetContext(ctx)\n\treq.SetHeader(\"accept\", \"*/*\")\n\treq.SetHeader(\"origin\", \"https://www.doubao.com\")\n\treq.SetHeader(\"referer\", \"https://www.doubao.com/\")\n\treq.SetHeader(\"user-agent\", \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36\")\n\treq.SetHeader(\"rpc-persist-doubao-pan\", \"true\")\n\treq.SetHeader(\"x-block-seq\", strconv.Itoa(block.Seq))\n\treq.SetHeader(\"x-block-checksum\", block.Checksum)\n\tif auth := d.resolveAuthorization(); auth != \"\" {\n\t\treq.SetHeader(\"authorization\", auth)\n\t}\n\tif dpop := d.resolveDpop(); dpop != \"\" {\n\t\treq.SetHeader(\"dpop\", dpop)\n\t}\n","sourceCodeStart":809,"sourceCodeEnd":845,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/doubao_new/util.go#L809-L845","documentation":"uploadBlockV3 requires a non-empty payload slice; an empty block body cannot be PUT to the block endpoint. Follows from the same data/size consistency problems as the empty-data merge error: the fallback received a zero-length slice for a block it intends to transmit.","triggerScenarios":"Slicing data[offset:offset+size] when size == 0 (guarded earlier, so only via direct calls) or an empty data buffer passed by a custom retry wrapper; empty-file uploads routed through the block path.","commonSituations":"Empty files reaching the chunked upload code; truncated spool files; custom wrappers that copy buffers and lose length.","solutions":["Route 0-byte files around the block upload entirely.","Skip blocks whose computed payload length is 0 when assembling the group.","If hit mid-fallback, restart the upload from prepare."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if len(payload) == 0 {\n    return fmt.Errorf(\"empty payload for block seq %d; restart upload\", block.Seq)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Skip zero-length blocks when assembling groups.","Handle 0-byte files outside the chunked path."],"tags":["doubao","upload","validation","empty-file"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}