{"record":{"id":"3a6ad85fb7228425","repo":"AlistGo/alist","slug":"file-id-is-required","errorCode":null,"errorMessage":"file_id is required","messagePattern":"file_id is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/123_open/other.go","lineNumber":142,"sourceCode":"\tif err != nil {\n\t\treturn fmt.Errorf(\"encode arguments: %w\", err)\n\t}\n\tif err := utils.Json.Unmarshal(raw, target); err != nil {\n\t\treturn fmt.Errorf(\"decode arguments: %w\", err)\n\t}\n\treturn nil\n}\n\n// resolveFileID prefers an explicitly passed id and falls back to the object\n// the request was addressed to.\nfunc resolveFileID(args model.OtherArgs, explicit int64) (int64, error) {\n\tif explicit != 0 {\n\t\treturn explicit, nil\n\t}\n\tif args.Obj != nil {\n\t\treturn parseFileID(args.Obj.GetID())\n\t}\n\treturn 0, errors.New(\"file_id is required\")\n}\n\n// resolveFileIDs falls back to the addressed object when no list was given.\nfunc resolveFileIDs(args model.OtherArgs, explicit []int64) ([]int64, error) {\n\tif len(explicit) > 0 {\n\t\treturn explicit, nil\n\t}\n\tif args.Obj == nil {\n\t\treturn nil, errors.New(\"file_ids is required\")\n\t}\n\tid, err := parseFileID(args.Obj.GetID())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn []int64{id}, nil\n}\n\n// Shared request and response shapes.","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/123_open/other.go#L124-L160","documentation":"Returned by Terabox.Put (drivers/terabox/driver.go:268) when the final /api/create call (which commits the uploaded chunks) reports errno != 0. All chunks were already transferred, so a failure here usually means the commit was rejected server-side, potentially leaving a partial state.","triggerScenarios":"Block list mismatch between precreate and create (corrupted chunk md5s); target path became invalid mid-upload; quota hit between precreate and create; session/jsToken expiry during a long upload; server-side dedupe or rapid-upload rejection.","commonSituations":"Very large uploads over slow links outliving the jsToken validity; source file modified while being read causing md5 drift; concurrent writes to the same target; transient Terabox backend errors.","solutions":["Retry the upload end-to-end after refreshing the storage session (Init) — most transient/session causes resolve.","Verify the source file is not being modified during upload (stable md5s), and re-put.","Check the destination folder still exists and quota is sufficient.","If errno indicates the file already exists and overwrite semantics matter, handle the exists case explicitly instead of relying on the raw error."],"exampleFix":"// before\nif createResp.Errno != 0 {\n\treturn fmt.Errorf(\"[terabox] failed to create file, errno: %d\", createResp.Errno)\n}\n\n// after: refresh session and retry once on transient errno\nif createResp.Errno != 0 {\n\tif isTransientErrno(createResp.Errno) && attempt < maxAttempts {\n\t\t_ = d.Init(ctx) // refresh jsToken/session\n\t\tattempt++\n\t\tcontinue // restart upload loop\n\t}\n\treturn fmt.Errorf(\"[terabox] failed to create file, errno: %d\", createResp.Errno)\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":"func isTeraboxCreateErr(err error) bool {\n\treturn err != nil && strings.Contains(err.Error(), \"failed to create file\")\n}","tryCatchPattern":"err := d.Put(ctx, dstDir, file, overwrite, session)\nif isTeraboxCreateErr(err) {\n\t_ = d.Init(ctx) // refresh session\n\terr = d.Put(ctx, dstDir, file, overwrite, session) // one retry\n}","preventionTips":["For multi-GB files, refresh jsToken (re-Init) periodically during long uploads.","Avoid modifying source files mid-upload.","Handle file-exists errnos explicitly when overwrite semantics matter."],"tags":["terabox","upload","commit","api-error"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}