AlistGo/alist · error
API key is required
Error message
API key is required
What it means
Returned by Darkibox.Init when the Addition's APIKey field is empty. The Darkibox driver authenticates every request by injecting the key as a query parameter (callAPI adds ?key=...), so an empty key cannot work; Init fails fast before any network call rather than producing confusing 401s later. Storage cannot be added until a key is supplied.
Source
Thrown at drivers/darkibox/driver.go:32
"github.com/alist-org/alist/v3/internal/op"
)
type Darkibox struct {
model.Storage
Addition
}
func (d *Darkibox) Config() driver.Config {
return config
}
func (d *Darkibox) GetAddition() driver.Additional {
return &d.Addition
}
func (d *Darkibox) Init(ctx context.Context) error {
if d.APIKey == "" {
return fmt.Errorf("API key is required")
}
if d.RootFolderID == "" {
d.RootFolderID = "0"
}
// Verify API key by calling account/info
var account accountInfoResult
if err := d.callAPI(ctx, "/account/info", nil, &account); err != nil {
return fmt.Errorf("failed to verify API key: %w", err)
}
op.MustSaveDriverStorage(d)
return nil
}
func (d *Darkibox) Drop(ctx context.Context) error {
return nil
}View on GitHub (pinned to 843d9dc814)
Solutions
- Fill in the Darkibox API key in the storage addition settings and save
- Get the key from your Darkibox account page (account/API section) and paste it exactly, without surrounding whitespace
- If set via API/automation, ensure the addition JSON includes a non-empty api_key field
- Verify after saving that Init succeeds (storage shows as working)
Example fix
// before
{"driver":"darkibox","addition":{"api_key":""}}
// after
{"driver":"darkibox","addition":{"api_key":"YOUR_DARKIBOX_KEY"}} Defensive patterns
Strategy: validation
Validate before calling
// Before adding the storage, assert a non-empty key
if strings.TrimSpace(addition.APIKey) == "" {
return errors.New("api_key is required for darkibox storage")
} Type guard
func hasDarkiboxKey(a Addition) bool {
return strings.TrimSpace(a.APIKey) != ""
} Try / catch
if err := d.Init(ctx); err != nil {
if err.Error() == "API key is required" {
// config omission: collect the key and re-save; no retry helps
return errors.New("set the Darkibox API key in storage settings")
}
return err
} Prevention
- Make API key a required field in provisioning automation (fail the form/script on empty)
- Copy the key directly from the Darkibox account page; avoid whitespace
- After adding, confirm storage status shows work to validate the whole chain
When it happens
Trigger: Adding a Darkibox storage in the AList admin UI with the API key field left blank; programmatically creating the storage with an empty addition; the key field name changing between versions so the submitted value lands in the wrong field.
Common situations: Forgetting to fill the api_key field; copy-pasting into the wrong field; automation scripts omitting the key; schema changes after driver upgrades dropping the stored key.
Related errors
- api_key is empty
- can't find remote storage: %w
- remote_path is required
- chunk_size must be positive
- owner and repo are required
AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15).
Data as JSON: /api/errors/6c877a1a18702023.
Report an issue: GitHub.