AlistGo/alist · error
API token is required
Error message
API token is required
What it means
Init refuses to start because the required Gofile API token addition is empty; every authenticated Gofile API call would fail, so the driver fails fast at mount time.
Solutions
- Get a token from Gofile: log in at gofile.io, copy the account token from the admin/API page
- Paste it into the driver's 'API token' field in the storage config and save
- If configuring via API, ensure the addition JSON includes a non-empty api_token matching the driver's field name
Example fix
// before: empty addition
{"driver":"Gofile","addition":"{\"api_token\":\"\"}"}
// after
{"driver":"Gofile","addition":"{\"api_token\":\"ey...\"}"} Defensive patterns
Strategy: validation
Validate before calling
if strings.TrimSpace(cfg.APIToken) == "" {
return errors.New("configure the Gofile API token before enabling this storage")
} Prevention
- Treat the token field as required in any storage-creation automation
- Fetch the token from gofile.io admin page at setup time and store it in a secret manager
When it happens
Trigger: Adding/enabling the Gofile storage driver in admin settings without filling in the API token field, or sending an empty token when programmatically creating the storage.
Common situations: New storage created with defaults; token field cleared when editing other settings; token stored in wrong additional-field key when configuring via API/JSON import.
Related errors
- empty token
- api_key is empty
- authorization is empty and credentials are not provided
- authorization should not include Basic prefix
- baidu youth sk is empty
AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15).
Data as JSON: /api/errors/4aa3fe9dcdf30f9d.
Report an issue: GitHub.
Appendix: source
Thrown at drivers/gofile/driver.go:31
type Gofile struct {
model.Storage
Addition
accountId string
}
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
}
View on GitHub (pinned to 843d9dc814)