AlistGo/alist · error
darkibox api error: status=%d msg=%s
Error message
darkibox api error: status=%d msg=%s
What it means
The Darkibox API answered HTTP 200 but its envelope reported status != 200 — the provider's application-level error. The message includes the provider's numeric status and msg, which map to Darkibox's documented error codes (invalid key, file not found, folder missing, etc.).
Source
Thrown at drivers/darkibox/util.go:42
continue
}
query[k] = v
}
var resp apiResponse
r, err := base.RestyClient.R().
SetContext(ctx).
SetQueryParams(query).
SetResult(&resp).
Get(apiBase + endpoint)
if err != nil {
return err
}
if r.StatusCode() != http.StatusOK {
return fmt.Errorf("darkibox http error: %d", r.StatusCode())
}
if resp.Status != 200 {
return fmt.Errorf("darkibox api error: status=%d msg=%s", resp.Status, resp.Msg)
}
if out == nil || len(resp.Result) == 0 || string(resp.Result) == "null" {
return nil
}
if err := json.Unmarshal(resp.Result, out); err != nil {
return fmt.Errorf("decode darkibox result failed: %w", err)
}
return nil
}
// fldIDStr converts a folder ID (which may be the root "0") to a string suitable for API params.
func fldIDStr(id string) string {
if id == "" {
return "0"
}
return id
}
View on GitHub (pinned to 843d9dc814)
Solutions
- Look up the numeric status in the Darkibox API error-code table; the msg string usually states the reason directly
- Refresh the listing and retry with current IDs; if the object is gone, surface 'not found' to the user instead of retrying
- For permission msgs, use a key with write scope for write operations
Example fix
// before
if resp.Status != 200 {
return fmt.Errorf("darkibox api error: status=%d msg=%s", resp.Status, resp.Msg)
}
// after — translate known codes to typed errors the framework understands
if resp.Status != 200 {
if resp.Msg == "file not found" || resp.Status == 404 {
return errs.ObjectNotFound
}
return fmt.Errorf("darkibox api error: status=%d msg=%s", resp.Status, resp.Msg)
} Defensive patterns
Strategy: try-catch
Validate before calling
if d.APIKey == "" {
return errors.New("API key required")
}
if parentRef != "" && !folderExists(ctx, parentRef) {
return errors.New("target folder missing")
} Try / catch
if m := regexp.MustCompile(`darkibox api error: status=(\d+) msg=(.*)`).FindStringSubmatch(err.Error()); m != nil {
if strings.Contains(m[2], "not found") { return errs.ObjectNotFound }
if m[1] == "401" || strings.Contains(m[2], "key") { return reconfigureKey() }
} Prevention
- Map provider status codes to typed errors at the callAPI boundary
- Refresh object IDs before mutations
- Use write-scoped keys for write operations
When it happens
Trigger: Operations where the provider validates business rules: listing a deleted folder, moving a nonexistent file_code, creating a folder with a duplicate/illegal name, or an API key without the required permission for that endpoint.
Common situations: Stale object IDs after remote changes by another client; key scoped read-only being used for writes; account quota exhausted mid-operation.
Related errors
- darkibox http error: %d
- create folder failed: %w
- move file failed: %w
- get upload server failed: %w
- decode darkibox result failed: %w
AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15).
Data as JSON: /api/errors/ce07c823037b8fd8.
Report an issue: GitHub.