AlistGo/alist · error
[doubao_new] invalid block size from needed list: seq=%d siz
Error message
[doubao_new] invalid block size from needed list: seq=%d size=%d
What it means
Doubao_new validation of server data: an entry in NeededUploadBlocks carries Size <= 0, which is impossible to read or checksum. The client rejects it before attempting any I/O because buf := make([]byte, item.Size) would panic or misbehave.
Source
Thrown at drivers/doubao_new/driver.go:347
groupSeqs = groupSeqs[:0]
groupChecksums = groupChecksums[:0]
groupSizes = groupSizes[:0]
groupRealSize = 0
groupExpectSum = 0
groupBuf.Reset()
if up != nil {
percent := float64(uploadedBytes) / float64(totalSize) * 100
up(percent)
}
return nil
}
for _, item := range needed.NeededUploadBlocks {
if _, ok := blockMeta[item.Seq]; !ok {
return nil, fmt.Errorf("[doubao_new] missing block meta for seq %d", item.Seq)
}
if item.Size <= 0 {
return nil, fmt.Errorf("[doubao_new] invalid block size from needed list: seq=%d size=%d", item.Seq, item.Size)
}
offset := int64(item.Seq) * blockSize
buf := make([]byte, int(item.Size))
n, err := tmpFile.ReadAt(buf, offset)
if err != nil && err != io.EOF && err != io.ErrUnexpectedEOF {
return nil, err
}
if n != len(buf) {
return nil, fmt.Errorf("[doubao_new] short read: seq=%d want=%d got=%d", item.Seq, len(buf), n)
}
buf = buf[:n]
realAdler := adler32String(buf)
if realAdler != item.Checksum {
return nil, fmt.Errorf("[doubao_new] block checksum mismatch: seq=%d offset=%d adler32=%s step2=%s", item.Seq, offset, realAdler, item.Checksum)
}
payloadStart := groupBuf.Len()
groupBuf.Write(buf)
payloadEnd := groupBuf.Len()View on GitHub (pinned to 843d9dc814)
Solutions
- If ALL uploads fail this way, suspect an API field rename — update/rebuild the doubao_new driver
- Retry once to rule out a one-off malformed response
- Capture the raw needed-blocks JSON (add temporary logging) and compare field names against the driver's structs
- Report upstream with the raw response body
- Re-login to get a fresh session; some malformed responses correlate with expired auth
Defensive patterns
Strategy: validation
Validate before calling
for _, item := range needed.NeededUploadBlocks {
if item.Size <= 0 {
return fmt.Errorf("server returned invalid block size for seq %d; aborting before I/O", item.Seq)
}
} Type guard
func validBlockItem(item NeededBlock) bool {
return item.Seq >= 0 && item.Size > 0 && item.Checksum != ""
} Try / catch
// treat as API contract break: fail fast with the raw entry for diagnostics
if !validBlockItem(item) {
log.Printf("[doubao_new] malformed needed entry: %+v", item)
return nil, fmt.Errorf("[doubao_new] invalid block size from needed list: seq=%d size=%d", item.Seq, item.Size)
} Prevention
- Validate all server-supplied sizes before allocation (the driver does — keep it)
- If it fires for every file, diff raw JSON against driver structs; field renames are the usual cause
- Pin driver versions that match the current Doubao web API
When it happens
Trigger: The needed-blocks endpoint returns a zero/negative size for a seq — server-side data anomaly, response shape change where Size unmarshals from the wrong field (so stays 0), or the seq refers to a block the server already has and the entry is malformed.
Common situations: Doubao web API contract change renaming size fields (Size vs BlockSize vs size), partial JSON so numbers stay zero, or server bug. Almost always paired with a broader upload failure for all files, not one specific file.
Related errors
- file size cannot be zero
- [doubao_new] merge blocks invalid body len: got=%d expect=%d
- [doubao_new] merge blocks incomplete: %v
- [doubao_new] merge blocks missing seq %d
- [doubao_new] missing block meta for seq %d
AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15).
Data as JSON: /api/errors/72f4aa062482cce6.
Report an issue: GitHub.