{"record":{"id":"269bac75ec961a8e","repo":"AlistGo/alist","slug":"wukong-apply-upload-inner-failed-s","errorCode":null,"errorMessage":"wukong apply upload inner failed: %s","messagePattern":"wukong apply upload inner failed: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/wukong/driver.go","lineNumber":452,"sourceCode":"\t\tspaceName = videoSpaceName\n\t}\n\tq := map[string]string{\n\t\t\"Action\":          \"ApplyUploadInner\",\n\t\t\"Version\":         \"2020-11-19\",\n\t\t\"SpaceName\":       spaceName,\n\t\t\"FileType\":        uploadType,\n\t\t\"IsInner\":         \"1\",\n\t\t\"ClientBestHosts\": bestHosts,\n\t\t\"NeedFallback\":    \"true\",\n\t\t\"FileSize\":        strconv.FormatInt(fileSize, 10),\n\t\t\"s\":               randomString(8),\n\t}\n\tvar resp applyUploadInnerResp\n\tif err := d.vodRequest(ctx, http.MethodGet, q, nil, auth, &resp); err != nil {\n\t\treturn nil, err\n\t}\n\tif resp.ResponseMetadata.Error.Code != \"\" {\n\t\treturn nil, fmt.Errorf(\"wukong apply upload inner failed: %s\", resp.ResponseMetadata.Error.Message)\n\t}\n\treturn &resp, nil\n}\n\nfunc (d *Wukong) commitUploadInner(ctx context.Context, auth *uploadAuthTokenResp, spaceName, sessionKey string) (string, error) {\n\tq := map[string]string{\n\t\t\"Action\":    \"CommitUploadInner\",\n\t\t\"Version\":   \"2020-11-19\",\n\t\t\"SpaceName\": spaceName,\n\t}\n\tbody, _ := json.Marshal(map[string]any{\n\t\t\"SessionKey\": sessionKey,\n\t\t\"Functions\":  []any{},\n\t})\n\tvar resp commitUploadInnerResp\n\tif err := d.vodRequest(ctx, http.MethodPost, q, body, auth, &resp); err != nil {\n\t\treturn \"\", err\n\t}","sourceCodeStart":434,"sourceCodeEnd":470,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/wukong/driver.go#L434-L470","documentation":"Thrown by applyUploadInner when the VOD ApplyUploadInner action returns a response metadata error. ApplyUploadInner reserves the upload session (StoreURI, upload hosts, auth for TOS) using FileSize, FileType, ClientBestHosts and NeedFallback=true; an error here means no upload session was granted.","triggerScenarios":"FileSize mismatch with the actual stream; upload type (video vs other) not allowed for the space; token from auth_token lacking scope for ApplyUploadInner; invalid ClientBestHosts after a failed candidates step; upstream capacity error.","commonSituations":"File grew between stat and upload (size passed via strconv from stale metadata); uploading a type the Wukong pan rejects; reusing a token across many parallel uploads until it expires mid-flow.","solutions":["Re-stat the local file and pass its current size, then retry with a fresh auth token","Retry with backoff once — ApplyUploadInner errors are often transient (NeedFallback path already hints at upstream flakiness)","Ensure uploadType maps correctly via uploadSourceByType and the space matches (video vs auth.SpaceName)","Re-login and restart the whole Put flow if the token is expired"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"inner, err := d.applyUploadInner(ctx, auth, uploadType, size, hosts)\nif err != nil {\n    // transient VOD errors are common: one backoff retry with fresh token\n    time.Sleep(2 * time.Second)\n    auth, _ = d.getUploadAuthToken(ctx, uploadType)\n    if auth != nil {\n        inner, err = d.applyUploadInner(ctx, auth, uploadType, size, hosts)\n    }\n    if err != nil { return err }\n}","preventionTips":["Pass the real current file size, never a cached stat","Retry apply once with backoff before failing the whole upload","Wrap the entire VOD flow (token→apply→upload→commit) so retries always start from a consistent session"],"tags":["wukong","upload","vod","apply-upload-inner","go"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}