AlistGo/alist · error

failed to check user: %s

Error message

failed to check user: %s

What it means

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.

Source

Thrown at drivers/dropbox/driver.go:46

}

func (d *Dropbox) GetAddition() driver.Additional {
	return &d.Addition
}

func (d *Dropbox) Init(ctx context.Context) error {
	query := "foo"
	res, err := d.request("/2/check/user", http.MethodPost, func(req *resty.Request) {
		req.SetBody(base.Json{
			"query": query,
		})
	})
	if err != nil {
		return err
	}
	result := utils.Json.Get(res, "result").ToString()
	if result != query {
		return fmt.Errorf("failed to check user: %s", string(res))
	}
	d.RootNamespaceId, err = d.GetRootNamespaceId(ctx)

	return err
}

func (d *Dropbox) GetRootNamespaceId(ctx context.Context) (string, error) {
	res, err := d.request("/2/users/get_current_account", http.MethodPost, func(req *resty.Request) {
		req.SetBody(nil)
	})
	if err != nil {
		return "", err
	}
	var currentAccountResp CurrentAccountResp
	err = utils.Json.Unmarshal(res, &currentAccountResp)
	if err != nil {
		return "", err
	}

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Re-do the OAuth flow and paste a genuine refresh token (not the short-lived authorization code) into the driver config
  2. Verify ClientID/ClientSecret match the Dropbox app that issued the refresh token
  3. 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
  4. Delete and re-add the storage so AccessToken state is rebuilt from scratch
Defensive patterns

Strategy: validation

Validate before calling

// before adding the storage, sanity-check the token
tok, err := dropboxDriver.ExchangeForAccessToken() // or manual OAuth flow
if err != nil || tok == "" { return errors.New("refresh token invalid; redo OAuth flow") }

Try / catch

if err := d.Init(ctx); err != nil {
    if strings.Contains(err.Error(), "failed to check user") {
        // auth config is wrong; do not retry, ask user to redo OAuth
        return fmt.Errorf("dropbox auth misconfigured: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15). Data as JSON: /api/errors/0192eff72ea09827. Report an issue: GitHub.