AlistGo/alist · error

failed to get account ID: %w

Error message

failed to get account ID: %w

What it means

Wrapped error from Gofile Init: the getAccountId call failed. Init first calls the Gofile 'getAccount' endpoint to resolve the account ID from the API token; any transport error or API error from that call is wrapped as 'failed to get account ID: <cause>'.

Source

Thrown at drivers/gofile/driver.go:37

}

func (d *Gofile) Config() driver.Config {
	return config
}

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

func (d *Gofile) Init(ctx context.Context) error {
	if d.APIToken == "" {
		return fmt.Errorf("API token is required")
	}

	// Get account ID
	accountId, err := d.getAccountId(ctx)
	if err != nil {
		return fmt.Errorf("failed to get account ID: %w", err)
	}
	d.accountId = accountId

	// Get account info to set root folder if not specified
	if d.RootFolderID == "" {
		accountInfo, err := d.getAccountInfo(ctx, accountId)
		if err != nil {
			return fmt.Errorf("failed to get account info: %w", err)
		}
		d.RootFolderID = accountInfo.Data.RootFolder
	}

	// Save driver storage
	op.MustSaveDriverStorage(d)
	return nil
}

func (d *Gofile) Drop(ctx context.Context) error {

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Check the wrapped cause: 'gofile API error: ...' means bad token, HTTP xxx means service/network issue
  2. Verify the token by calling curl -H 'Authorization: Bearer TOKEN' https://api.gofile.io/accounts/getAccountDetails
  3. Fix network egress/DNS/proxy for api.gofile.io if the cause is a transport error
  4. Regenerate the token in the Gofile dashboard if revoked
Defensive patterns

Strategy: try-catch

Try / catch

if err := d.Init(ctx); err != nil {
  if strings.HasPrefix(err.Error(), "failed to get account ID") {
    // inspect inner cause: token vs network; reconfig token or retry later
  }
}

Prevention

When it happens

Trigger: Init with an invalid/expired API token (Gofile returns error status and handleError fires), network/DNS failure to api.gofile.io, or proxy blocking the request.

Common situations: Token pasted incorrectly (truncated/extra spaces); token revoked or account deleted; server has no outbound access to gofile.io; gofile.io under maintenance returning 5xx.

Related errors


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