AlistGo/alist · error

oss: chunkNum invalid

Error message

oss: chunkNum invalid

What it means

Raised by Streamtape.callAPI (drivers/streamtape/util.go:41) when the HTTP response status from api.streamtape.com is anything other than 200, before the JSON envelope is inspected. It signals transport/auth-level failure at the HTTP layer (e.g. 401/403 bad key, 404 wrong endpoint, 429/5xx upstream issues), not a Streamtape business error.

Source

Thrown at drivers/115/util.go:529

	}
	// 单个分片大小不能小于100KB
	if chunks[0].Size < 100*utils.KB {
		if chunks, err = SplitFileByPartSize(fileSize, 100*utils.KB); err != nil {
			return
		}
	}
	return
}

// SplitFileByPartNum splits big file into parts by the num of parts.
// Split the file with specified parts count, returns the split result when error is nil.
func SplitFileByPartNum(fileSize int64, chunkNum int) ([]oss.FileChunk, error) {
	if chunkNum <= 0 || chunkNum > 10000 {
		return nil, errors.New("chunkNum invalid")
	}

	if int64(chunkNum) > fileSize {
		return nil, errors.New("oss: chunkNum invalid")
	}

	var chunks []oss.FileChunk
	chunk := oss.FileChunk{}
	chunkN := (int64)(chunkNum)
	for i := int64(0); i < chunkN; i++ {
		chunk.Number = int(i + 1)
		chunk.Offset = i * (fileSize / chunkN)
		if i == chunkN-1 {
			chunk.Size = fileSize/chunkN + fileSize%chunkN
		} else {
			chunk.Size = fileSize / chunkN
		}
		chunks = append(chunks, chunk)
	}

	return chunks, nil
}

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Verify the stored Streamtape credentials (login/account key) and re-authenticate the storage if needed.
  2. Retry with backoff for 429/5xx — these are typically transient.
  3. Log the status code together with the endpoint to distinguish auth (401/403) from capacity (429/5xx), and check Streamtape status/API docs if it persists on all endpoints.
  4. If a proxy is in the path, bypass it or add proper exceptions for api.streamtape.com.

Example fix

// before: call once, fail hard on first 429/503
res, err := d.callAPI(ctx, "/file/info", q, &out)

// after: retry transient statuses
var out fileInfoResult
err := retryOnTransient(func() error {
	e := d.callAPI(ctx, "/file/info", q, &out)
	if e != nil && isRetryableStreamtapeHTTP(e) {
		return e
	}
	return retry.Stop(e)
})
Defensive patterns

Strategy: retry

Validate before calling

// optional pre-flight: cheap endpoint probe
var probe struct{}
if err := d.callAPI(ctx, "/account/info", map[string]string{}, &probe); err != nil {
	// surface credentials/network problem before the real operation
}

Try / catch

var lastErr error
for i := 0; i < 3; i++ {
	lastErr = d.callAPI(ctx, endpoint, query, out)
	if lastErr == nil || !isRetryableStreamtapeHTTP(lastErr) {
		break
	}
	time.Sleep(time.Duration(i+1) * time.Second)
}
// isRetryableStreamtapeHTTP: status 429 or 5xx parsed from the error string

Prevention

When it happens

Trigger: Any driver API call (list, file/info, remotedl/*, getsplash) where the server or an intermediate proxy returns a non-200 status: invalid or revoked login key (401/403), rate limiting (429), Cloudflare/CDN block page (403/503), or a temporary outage (5xx).

Common situations: Expired Streamtape account API key configured for the storage; IP blocked or rate-limited after aggressive polling (e.g. remoteDlStatus loops); endpoint paths changed after a Streamtape API revision; restrictive corporate proxy rewriting responses.

Related errors


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