AlistGo/alist · error

[doubao_new] upload v3 block missing upload_id

Error message

[doubao_new] upload v3 block missing upload_id

What it means

uploadBlockV3 (the per-block fallback re-upload path used after a 400/code-2 merge rejection) validates that uploadID is non-empty before building the request. An empty uploadID means the caller passed the identifier from a failed/uninitialized prepare.

Source

Thrown at drivers/doubao_new/util.go:821

				}
				success = append(success, seq)
				offset += int(size)
			}
			return UploadMergeData{SuccessSeqList: success}, nil
		}
		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 != "" {

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Ensure the uploadID from the prepare response is propagated verbatim into every blocks/merge/v3 call.
  2. Fail fast right after prepare if UploadID is empty rather than continuing into block upload.
  3. Do not retry on this error — it is deterministic until the prepare step is redone.

Example fix

// before
d.uploadBlockV3(ctx, "", block, payload)

// after
if uploadID == "" {
    return fmt.Errorf("[doubao_new] cannot upload block: prepare returned no upload_id")
}
d.uploadBlockV3(ctx, uploadID, block, payload)
Defensive patterns

Strategy: validation

Validate before calling

if uploadID == "" {
    return fmt.Errorf("cannot upload block: missing upload_id (re-run prepare)")
}

Prevention

When it happens

Trigger: Calling uploadBlockV3 directly with ""; or the fallback loop receiving an uploadID that was emptied/never set because prepare failed softly. In stock code mergeUploadBlocks already validated uploadID, so this is a defensive guard mostly relevant to refactors and direct callers.

Common situations: Custom code extracting the v3 fallback into a retry helper and losing the uploadID parameter; prepare response missing the field after an API change.

Related errors


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