{"record":{"id":"0192eff72ea09827","repo":"AlistGo/alist","slug":"failed-to-check-user-s","errorCode":null,"errorMessage":"failed to check user: %s","messagePattern":"failed to check user: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/dropbox/driver.go","lineNumber":46,"sourceCode":"}\n\nfunc (d *Dropbox) GetAddition() driver.Additional {\n\treturn &d.Addition\n}\n\nfunc (d *Dropbox) Init(ctx context.Context) error {\n\tquery := \"foo\"\n\tres, err := d.request(\"/2/check/user\", http.MethodPost, func(req *resty.Request) {\n\t\treq.SetBody(base.Json{\n\t\t\t\"query\": query,\n\t\t})\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tresult := utils.Json.Get(res, \"result\").ToString()\n\tif result != query {\n\t\treturn fmt.Errorf(\"failed to check user: %s\", string(res))\n\t}\n\td.RootNamespaceId, err = d.GetRootNamespaceId(ctx)\n\n\treturn err\n}\n\nfunc (d *Dropbox) GetRootNamespaceId(ctx context.Context) (string, error) {\n\tres, err := d.request(\"/2/users/get_current_account\", http.MethodPost, func(req *resty.Request) {\n\t\treq.SetBody(nil)\n\t})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tvar currentAccountResp CurrentAccountResp\n\terr = utils.Json.Unmarshal(res, &currentAccountResp)\n\tif err != nil {\n\t\treturn \"\", err\n\t}","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/dropbox/driver.go#L28-L64","documentation":"During Init, the Dropbox driver calls /2/check/user with query \"foo\" and expects the same string echoed back in the result field. A 200 response whose result does not match means the endpoint responded but not as a functioning authenticated echo — typically an HTML error page from a proxy, an unexpected response shape, or an auth context that silently degraded. It usually indicates the access token/refresh token pair is bad even though the HTTP call itself succeeded at transport level.","triggerScenarios":"Init() with an expired or revoked access token whose error body still returns 200 through some proxy layer; a malformed refresh token so the bearer header is garbage; an app in development mode accessing an account not on its team; a reverse proxy in front of dropbox.com returning an HTML page that unmarshals to an empty result.","commonSituations":"Copied the wrong value into the RefreshToken field (e.g., an authorization code instead of a refresh token); the Dropbox app was deleted or its secret rotated; stale driver storage holding a dead AccessToken; network middlebox mangling responses.","solutions":["Re-do the OAuth flow and paste a genuine refresh token (not the short-lived authorization code) into the driver config","Verify ClientID/ClientSecret match the Dropbox app that issued the refresh token","Inspect the logged response body (string(res)) to see what Dropbox actually returned — an HTML page indicates a proxy/URL problem, a JSON error indicates auth","Delete and re-add the storage so AccessToken state is rebuilt from scratch"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before adding the storage, sanity-check the token\ntok, err := dropboxDriver.ExchangeForAccessToken() // or manual OAuth flow\nif err != nil || tok == \"\" { return errors.New(\"refresh token invalid; redo OAuth flow\") }","typeGuard":null,"tryCatchPattern":"if err := d.Init(ctx); err != nil {\n    if strings.Contains(err.Error(), \"failed to check user\") {\n        // auth config is wrong; do not retry, ask user to redo OAuth\n        return fmt.Errorf(\"dropbox auth misconfigured: %w\", err)\n    }\n    return err\n}","preventionTips":["Never paste the authorization code where the refresh token belongs","Log and inspect the raw response body when the echo mismatch occurs","Test the app's token via the Dropbox API explorer before configuring the driver"],"tags":["dropbox","oauth","init","auth"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}