{"record":{"id":"7aedf97437026270","repo":"AlistGo/alist","slug":"doubao-new-short-read-seq-d-want-d-got-d","errorCode":null,"errorMessage":"[doubao_new] short read: seq=%d want=%d got=%d","messagePattern":"\\[doubao_new\\] short read: seq=(.+?) want=(.+?) got=(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/doubao_new/driver.go","lineNumber":356,"sourceCode":"\t\t\t}\n\t\t\treturn nil\n\t\t}\n\n\t\tfor _, item := range needed.NeededUploadBlocks {\n\t\t\tif _, ok := blockMeta[item.Seq]; !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"[doubao_new] missing block meta for seq %d\", item.Seq)\n\t\t\t}\n\t\t\tif item.Size <= 0 {\n\t\t\t\treturn nil, fmt.Errorf(\"[doubao_new] invalid block size from needed list: seq=%d size=%d\", item.Seq, item.Size)\n\t\t\t}\n\t\t\toffset := int64(item.Seq) * blockSize\n\t\t\tbuf := make([]byte, int(item.Size))\n\t\t\tn, err := tmpFile.ReadAt(buf, offset)\n\t\t\tif err != nil && err != io.EOF && err != io.ErrUnexpectedEOF {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif n != len(buf) {\n\t\t\t\treturn nil, fmt.Errorf(\"[doubao_new] short read: seq=%d want=%d got=%d\", item.Seq, len(buf), n)\n\t\t\t}\n\t\t\tbuf = buf[:n]\n\t\t\trealAdler := adler32String(buf)\n\t\t\tif realAdler != item.Checksum {\n\t\t\t\treturn nil, fmt.Errorf(\"[doubao_new] block checksum mismatch: seq=%d offset=%d adler32=%s step2=%s\", item.Seq, offset, realAdler, item.Checksum)\n\t\t\t}\n\t\t\tpayloadStart := groupBuf.Len()\n\t\t\tgroupBuf.Write(buf)\n\t\t\tpayloadEnd := groupBuf.Len()\n\t\t\tpayloadAdler := adler32String(groupBuf.Bytes()[payloadStart:payloadEnd])\n\t\t\tif payloadAdler != item.Checksum {\n\t\t\t\treturn nil, fmt.Errorf(\"[doubao_new] payload checksum mismatch: seq=%d start=%d end=%d adler32=%s step2=%s\", item.Seq, payloadStart, payloadEnd, payloadAdler, item.Checksum)\n\t\t\t}\n\t\t\tgroupSeqs = append(groupSeqs, item.Seq)\n\t\t\tgroupChecksums = append(groupChecksums, item.Checksum)\n\t\t\tgroupSizes = append(groupSizes, item.Size)\n\t\t\tgroupRealSize += int64(n)\n\t\t\tgroupExpectSum += item.Size","sourceCodeStart":338,"sourceCodeEnd":374,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/doubao_new/driver.go#L338-L374","documentation":"Doubao_new spool-read failure: tmpFile.ReadAt for a needed block returned fewer bytes (n) than the server-declared item.Size. The block lives at offset seq*blockSize in the local temp spool file, and the spool is shorter or sparser than expected at that offset.","triggerScenarios":"ReadAt at offset seq*blockSize hits EOF early because the temp file was truncated after being written (disk full, cleanup race), the spool write earlier silently wrote less than blockSize, or size/offset arithmetic overestimates the final block.","commonSituations":"Disk exhaustion in the temp directory mid-upload, /tmp cleaners deleting or truncating spool files on long uploads, or driver changes to blockSize without regenerating spool expectations.","solutions":["Check free space on the volume hosting the temp/spool directory; free space and retry","Retry the upload — spool is regenerated each attempt","Move the OpenList temp directory to a volume with adequate space for the full file","Verify the source file's size hasn't changed since upload start","If the last seq always short-reads, report the final-block sizing arithmetic upstream"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before reading blocks, confirm the spool covers the highest offset\nfi, err := tmpFile.Stat()\nif err != nil { return err }\nmaxOff := int64(maxNeededSeq)*blockSize + maxNeededSize\nif fi.Size() < maxOff {\n    return fmt.Errorf(\"spool too short: have=%d need=%d\", fi.Size(), maxOff)\n}","typeGuard":null,"tryCatchPattern":"if err := readBlock(...); err != nil && strings.Contains(err.Error(), \"short read\") {\n    return d.uploadPass(ctx, ...) // regenerate the spool from scratch\n}","preventionTips":["Monitor temp-volume free space during uploads","Point OpenList's temp dir at a volume with room for the whole file","Exclude spool dirs from tmp cleaners"],"tags":["doubao-new","upload","temp-file","disk-space","short-read","go"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}