AlistGo/alist · error
chunkSize invalid
Error message
chunkSize invalid
What it means
Raised by Streamtape.callAPI when HTTP status is 200 but the Streamtape JSON envelope reports resp.Status != 200 with resp.Msg describing the business error. This is the API's own error channel: bad parameters, unknown file/folder IDs, invalid upload IDs, permission problems, and similar domain failures.
Source
Thrown at drivers/115/util.go:553
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
}
// SplitFileByPartSize splits big file into parts by the size of parts.
// Splits the file by the part size. Returns the FileChunk when error is nil.
func SplitFileByPartSize(fileSize int64, chunkSize int64) ([]oss.FileChunk, error) {
if chunkSize <= 0 {
return nil, errors.New("chunkSize invalid")
}
chunkN := fileSize / chunkSize
if chunkN >= 10000 {
return nil, errors.New("Too many parts, please increase part size")
}
var chunks []oss.FileChunk
chunk := oss.FileChunk{}
for i := int64(0); i < chunkN; i++ {
chunk.Number = int(i + 1)
chunk.Offset = i * chunkSize
chunk.Size = chunkSize
chunks = append(chunks, chunk)
}
if fileSize%chunkSize > 0 {
chunk.Number = len(chunks) + 1View on GitHub (pinned to 843d9dc814)
Solutions
- Inspect status and msg in the error string: they tell you whether the referenced entity exists.
- Refresh the affected listing (re-List the parent folder) and retry with current IDs; drop stale cache entries.
- Validate parameters (ID format, joined file lists, URL values) against Streamtape API docs before sending.
- If msg indicates permission issues, review the account/API key scopes on the Streamtape dashboard.
Example fix
// before
if err := d.callAPI(ctx, "/remotedl/status", map[string]string{"id": id}, &res); err != nil {
return nil, err // opaque failure
}
// after
if err := d.callAPI(ctx, "/remotedl/status", map[string]string{"id": id}, &res); err != nil {
if strings.Contains(err.Error(), "streamtape api error") {
_ = d.refreshFolder(ctx, parentID) // entity may be gone: re-list
}
return nil, err
} Defensive patterns
Strategy: try-catch
Validate before calling
// cheap existence check before acting
var info fileInfoResult
if err := d.callAPI(ctx, "/file/info", map[string]string{"file": fileID}, &info); err == nil {
// entity exists, proceed
} Try / catch
err := d.callAPI(ctx, endpoint, query, out)
if err != nil && strings.Contains(err.Error(), "streamtape api error") {
// parse status/msg, refresh listings for stale-ID cases, surface msg to user
} Prevention
- Re-list folders after external modifications instead of trusting cached IDs.
- Validate parameter formats (joined file lists, URL values) before calls.
- Surface resp.Msg text to users — it carries the actionable business reason.
When it happens
Trigger: Passing a deleted or wrong folder/file ID to /file/info or /folder/list; calling /remotedl/status with an upload ID that no longer exists; submitting malformed slot/url parameters to /remotedl/add; insufficient account permissions for the requested operation.
Common situations: Stale cached object IDs after files were removed on the Streamtape side; concurrent modifications (another session deleted the remote upload); API parameter format changes (e.g. unescaped commas in file list) causing the API to reject the request.
Related errors
- oss: chunkNum invalid
- Too many parts, please increase part size
- e.Description
- env.Errmsg
- access_token expired: provide a refresh_token together with
AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15).
Data as JSON: /api/errors/34f65a4b48249db9.
Report an issue: GitHub.