AlistGo/alist · error

[doubao_new] upload v3 block empty data

Error message

[doubao_new] upload v3 block empty data

What it means

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.

Source

Thrown at drivers/doubao_new/util.go:827

		errMsg := resp.Msg
		if errMsg == "" {
			errMsg = resp.Message
		}
		return UploadMergeData{}, fmt.Errorf("[doubao_new] API error (code: %d): %s", resp.Code, errMsg)
	}

	return resp.Data, nil
}

func (d *DoubaoNew) uploadBlockV3(ctx context.Context, uploadID string, block UploadBlockNeed, data []byte) error {
	if uploadID == "" {
		return fmt.Errorf("[doubao_new] upload v3 block missing upload_id")
	}
	if block.Seq < 0 {
		return fmt.Errorf("[doubao_new] upload v3 block invalid seq")
	}
	if len(data) == 0 {
		return fmt.Errorf("[doubao_new] upload v3 block empty data")
	}

	req := base.RestyClient.R()
	req.SetContext(ctx)
	req.SetHeader("accept", "*/*")
	req.SetHeader("origin", "https://www.doubao.com")
	req.SetHeader("referer", "https://www.doubao.com/")
	req.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")
	req.SetHeader("rpc-persist-doubao-pan", "true")
	req.SetHeader("x-block-seq", strconv.Itoa(block.Seq))
	req.SetHeader("x-block-checksum", block.Checksum)
	if auth := d.resolveAuthorization(); auth != "" {
		req.SetHeader("authorization", auth)
	}
	if dpop := d.resolveDpop(); dpop != "" {
		req.SetHeader("dpop", dpop)
	}

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Route 0-byte files around the block upload entirely.
  2. Skip blocks whose computed payload length is 0 when assembling the group.
  3. If hit mid-fallback, restart the upload from prepare.
Defensive patterns

Strategy: validation

Validate before calling

if len(payload) == 0 {
    return fmt.Errorf("empty payload for block seq %d; restart upload", block.Seq)
}

Prevention

When it happens

Trigger: 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.

Common situations: Empty files reaching the chunked upload code; truncated spool files; custom wrappers that copy buffers and lose length.

Related errors


AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15). Data as JSON: /api/errors/cbc0a6843776dfe4. Report an issue: GitHub.