{"record":{"id":"8fcf7fb38b8321e0","repo":"AlistGo/alist","slug":"access-token-is-required-in-token-mode","errorCode":null,"errorMessage":"access_token is required in token mode","messagePattern":"access_token is required in token mode","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"drivers/123_open/client.go","lineNumber":30,"sourceCode":"\t\"github.com/alist-org/alist/v3/internal/op\"\n\tpan123 \"github.com/okatu-loli/go-123pan\"\n)\n\n// tokenRefreshMargin is how long before expiry a token is proactively renewed.\nconst tokenRefreshMargin = 10 * time.Minute\n\nvar errNoRefreshCredentials = errors.New(\"access_token expired: provide a refresh_token together with clientID/clientSecret, or switch to client_credentials mode\")\n\n// newSDKClient builds the SDK client for the configured authentication mode.\nfunc (d *Open123) newSDKClient() (*pan123.Client, error) {\n\topts := []pan123.Option{\n\t\tpan123.WithHTTPClient(&http.Client{Timeout: 60 * time.Second}),\n\t\tpan123.WithUserAgent(\"AList/\" + conf.Version),\n\t}\n\tswitch d.AuthMode {\n\tcase AuthToken:\n\t\tif d.AccessToken == \"\" {\n\t\t\treturn nil, errors.New(\"access_token is required in token mode\")\n\t\t}\n\t\tc := pan123.NewWithToken(d.AccessToken, opts...)\n\t\t// expiry is unknown for an externally issued token; refresh on demand\n\t\tc.SetToken(d.AccessToken, d.tokenExpiry())\n\t\treturn c, nil\n\tcase AuthClientCredentials, \"\":\n\t\tif d.ClientID == \"\" || d.ClientSecret == \"\" {\n\t\t\treturn nil, errors.New(\"clientID and clientSecret are required in client_credentials mode\")\n\t\t}\n\t\treturn pan123.New(d.ClientID, d.ClientSecret, opts...), nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unknown auth_mode: %s\", d.AuthMode)\n\t}\n}\n\n// tokenExpiry reports the stored expiry of an externally issued access token.\n// A zero time tells the SDK never to refresh on its own; renewal is driven by\n// ensureToken so the rotated refresh_token can be persisted.","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/123_open/client.go#L12-L48","documentation":"Returned by Terabox.Init (drivers/terabox/driver.go:48) when /api/check/login responds with errno 9000. Terabox uses region-locked domains; 9000 means the terabox.com endpoint is not offered for the region your egress IP appears to be in, so the driver cannot initialize at all.","triggerScenarios":"Mounting/initializing the Terabox storage from a server located in a region where Terabox (as opposed to regional variants like 1024tera/Dubox) is unavailable; using a datacenter IP (many datacenter ranges are geo-classified differently than expected); VPN egress changes after the storage was configured.","commonSituations":"Self-hosting on a VPS in a blocked region; ISP-level geo-routing changes; Terabox tightening its geo-fence so IPs that used to work now get 9000.","solutions":["Route the server's traffic through an egress in a supported region (VPN/proxy) so API calls come from an allowed IP.","If available in your region, use the corresponding regional Terabox variant driver/domain instead of www.terabox.com.","Verify with a manual curl to https://www.terabox.com/api/check/login with the configured cookie from the same host to confirm the block is IP-based, not account-based.","Re-check after some time if the geo-block is transient or newly introduced."],"exampleFix":"// before\nbaseURL := \"https://www.terabox.com\" // from blocked-region server -> errno 9000\n\n// after: egress via allowed-region proxy\ntransport := &http.Transport{Proxy: http.ProxyURL(proxyInSupportedRegion)}\nclient := resty.New().SetTransport(transport)","handlingStrategy":"fallback","validationCode":"// probe region availability before mounting\nvar resp CheckLoginResp\n_, err := d.get(\"/api/check/login\", nil, &resp)\nif err == nil && resp.Errno == 9000 {\n\t// route via supported-region egress before adding the storage\n}","typeGuard":null,"tryCatchPattern":"if err := storage.Init(ctx); err != nil && strings.Contains(err.Error(), \"not yet available in this area\") {\n\t// switch egress (VPN/proxy) or use the regional Terabox variant, then retry Init\n}","preventionTips":["Host the server (or proxy its egress) in a Terabox-supported region.","Check region availability with a manual API call when deploying to new infrastructure.","Monitor for this error after network/infrastructure changes."],"tags":["terabox","geo-block","driver-init","network"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}