{"record":{"id":"34f65a4b48249db9","repo":"AlistGo/alist","slug":"chunksize-invalid","errorCode":null,"errorMessage":"chunkSize invalid","messagePattern":"chunkSize invalid","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/115/util.go","lineNumber":553,"sourceCode":"\tfor i := int64(0); i < chunkN; i++ {\n\t\tchunk.Number = int(i + 1)\n\t\tchunk.Offset = i * (fileSize / chunkN)\n\t\tif i == chunkN-1 {\n\t\t\tchunk.Size = fileSize/chunkN + fileSize%chunkN\n\t\t} else {\n\t\t\tchunk.Size = fileSize / chunkN\n\t\t}\n\t\tchunks = append(chunks, chunk)\n\t}\n\n\treturn chunks, nil\n}\n\n// SplitFileByPartSize splits big file into parts by the size of parts.\n// Splits the file by the part size. Returns the FileChunk when error is nil.\nfunc SplitFileByPartSize(fileSize int64, chunkSize int64) ([]oss.FileChunk, error) {\n\tif chunkSize <= 0 {\n\t\treturn nil, errors.New(\"chunkSize invalid\")\n\t}\n\n\tchunkN := fileSize / chunkSize\n\tif chunkN >= 10000 {\n\t\treturn nil, errors.New(\"Too many parts, please increase part size\")\n\t}\n\n\tvar chunks []oss.FileChunk\n\tchunk := oss.FileChunk{}\n\tfor i := int64(0); i < chunkN; i++ {\n\t\tchunk.Number = int(i + 1)\n\t\tchunk.Offset = i * chunkSize\n\t\tchunk.Size = chunkSize\n\t\tchunks = append(chunks, chunk)\n\t}\n\n\tif fileSize%chunkSize > 0 {\n\t\tchunk.Number = len(chunks) + 1","sourceCodeStart":535,"sourceCodeEnd":571,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/115/util.go#L535-L571","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nif err := d.callAPI(ctx, \"/remotedl/status\", map[string]string{\"id\": id}, &res); err != nil {\n\treturn nil, err // opaque failure\n}\n\n// after\nif err := d.callAPI(ctx, \"/remotedl/status\", map[string]string{\"id\": id}, &res); err != nil {\n\tif strings.Contains(err.Error(), \"streamtape api error\") {\n\t\t_ = d.refreshFolder(ctx, parentID) // entity may be gone: re-list\n\t}\n\treturn nil, err\n}","handlingStrategy":"try-catch","validationCode":"// cheap existence check before acting\nvar info fileInfoResult\nif err := d.callAPI(ctx, \"/file/info\", map[string]string{\"file\": fileID}, &info); err == nil {\n\t// entity exists, proceed\n}","typeGuard":null,"tryCatchPattern":"err := d.callAPI(ctx, endpoint, query, out)\nif err != nil && strings.Contains(err.Error(), \"streamtape api error\") {\n\t// parse status/msg, refresh listings for stale-ID cases, surface msg to user\n}","preventionTips":["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."],"tags":["streamtape","api-error","upstream","stale-id"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}