{"record":{"id":"49012800eee1bf8e","repo":"AlistGo/alist","slug":"doubao-new-missing-block-meta-for-seq-d","errorCode":null,"errorMessage":"[doubao_new] missing block meta for seq %d","messagePattern":"\\[doubao_new\\] missing block meta for seq (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/doubao_new/driver.go","lineNumber":344,"sourceCode":"\t\t\t}\n\n\t\t\tuploadedBytes += groupRealSize\n\t\t\tgroupSeqs = groupSeqs[:0]\n\t\t\tgroupChecksums = groupChecksums[:0]\n\t\t\tgroupSizes = groupSizes[:0]\n\t\t\tgroupRealSize = 0\n\t\t\tgroupExpectSum = 0\n\t\t\tgroupBuf.Reset()\n\t\t\tif up != nil {\n\t\t\t\tpercent := float64(uploadedBytes) / float64(totalSize) * 100\n\t\t\t\tup(percent)\n\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}","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/doubao_new/driver.go#L326-L362","documentation":"Doubao_new incremental upload bookkeeping error: the server's NeededUploadBlocks list references a block seq that has no entry in the local blockMeta map built during upload preparation. The client cannot produce the metadata (checksum/size) needed to upload that block.","triggerScenarios":"The upload-prep phase populated blockMeta from one view of the file's blocks, then the needed-list query returned seqs outside that set — file grew/shrank between prep and upload, block size changed between calls, or a stale prep response was reused after a retry loop iteration.","commonSituations":"Uploading a file that is still being written (log files, exports), retry loops that reuse an old uploadPrep after the server rotated the session, or driver bug where blockMeta is keyed by different seq granularity than the needed list.","solutions":["Retry the entire upload (fresh prep + fresh needed query yields consistent views)","Ensure the source file is not modified during upload; upload a snapshot/copy instead","If it reproduces deterministically for one file, capture prep and needed-list responses and report the driver inconsistency","Update the doubao_new driver — prep/needed consistency handling improved in later revisions","Check that file size >= (maxSeq+1)*blockSize expectations; a truncated file can make server seqs exceed local meta"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before the needed-blocks loop, assert coverage\nmaxSeq := 0\nfor seq := range blockMeta {\n    if seq > maxSeq { maxSeq = seq }\n}\nif int64(maxSeq)*blockSize+maxBlockSize > fileSize+blockSize {\n    return fmt.Errorf(\"block meta inconsistent with file size; re-run prep\")\n}","typeGuard":null,"tryCatchPattern":"if err := uploadNeeded(...); err != nil && strings.Contains(err.Error(), \"missing block meta\") {\n    return d.uploadPass(ctx, ...) // fresh prep + needed query restores consistency\n}","preventionTips":["Snapshot files that change before uploading them","Never reuse an uploadPrep result across retry iterations","Re-run prep whenever the needed list looks foreign"],"tags":["doubao-new","upload","dedup","metadata","go"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}