{"record":{"id":"790351149fcc83ba","repo":"AlistGo/alist","slug":"file-ids-is-required","errorCode":null,"errorMessage":"file_ids is required","messagePattern":"file_ids is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/123_open/other.go","lineNumber":151,"sourceCode":"// 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.\ntype (\n\tfileIDRequest struct {\n\t\tFileID int64 `json:\"file_id\"`\n\t}\n\tfileIDsRequest struct {\n\t\tFileIDs []int64 `json:\"file_ids\"`\n\t}\n\t// okResult answers the operations the platform reports nothing about.\n\tokResult struct {","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/123_open/other.go#L133-L169","documentation":"Returned by the Terabox jsToken bootstrap (drivers/terabox/util.go:51) when scraping the dashboard HTML for the embedded token fails: getStrBetween cannot find the literal delimiters around window.jsToken. Without jsToken most authenticated API calls cannot be signed.","triggerScenarios":"Terabox ships a new front-end build that changes or removes the inline script that sets window.jsToken; the HTML returned is a captcha/verification/interstitial page instead of the dashboard (bot detection); cookie invalid so an unauthenticated page comes back; base_url serving different markup per region.","commonSituations":"After Terabox front-end deploys (most common cause — driver-vs-site drift); running from datacenter IPs triggering anti-bot pages; partially valid cookies; extensions or CDNs injecting markup.","solutions":["Update the driver / application to a version whose token extraction matches the current Terabox front-end.","Verify the cookie is fully valid (see check_login errno handling) — invalid cookies often yield a login page instead of the dashboard.","If an anti-bot page is returned, change egress IP or reduce request rate, then retry Init.","As a stopgap in a fork, patch getStrBetween delimiters to the new script signature seen in the logged HTML."],"exampleFix":"// before\njsToken := getStrBetween(html, \"`function%20fn%28a%29%7Bwindow.jsToken%20%3D%20a%7D%3Bfn%28%22`, `%22%29`\") // delimiters no longer match\n\n// after: fallback to regex against current markup\nm := regexp.MustCompile(`window\\.jsToken\\s*=\\s*\"([^\"]+)\"`).FindStringSubmatch(html)\nif m == nil {\n\treturn fmt.Errorf(\"jsToken not found, html: %s\", html)\n}\njsToken := m[1]","handlingStrategy":"try-catch","validationCode":"// detect interstitial/anti-bot pages before token extraction\nif !strings.Contains(html, \"jsToken\") {\n\t// likely login/captcha page: refresh cookie first\n}","typeGuard":"func isJsTokenErr(err error) bool {\n\treturn err != nil && strings.Contains(err.Error(), \"jsToken not found\")\n}","tryCatchPattern":"if err := d.refreshJsToken(); isJsTokenErr(err) {\n\t// 1) re-validate cookie, 2) update driver version, 3) retry once after rate-limit pause\n}","preventionTips":["Keep the application updated — Terabox front-end changes require extractor fixes.","Maintain a valid cookie; invalid sessions return login HTML instead of the dashboard.","Scrape at low frequency to avoid anti-bot interstitials."],"tags":["terabox","scraping","jstoken","upstream-drift"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}