AlistGo/alist · error

darkibox http error: %d

Error message

darkibox http error: %d

What it means

The central callAPI helper in the Darkibox driver rejects any non-200 HTTP status from the API endpoint. This error wraps every darkibox operation (list, mkdir, move, upload-server, etc.) when the transport succeeded but the server answered with an error status. Note it fires before the provider's own status/msg check, so no API-level detail is available.

Source

Thrown at drivers/darkibox/util.go:39

	}
	for k, v := range params {
		if strings.TrimSpace(v) == "" {
			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"
	}

View on GitHub (pinned to 843d9dc814)

Solutions

  1. curl the exact URL with the same query params to see the raw status and body; identify whether it is auth (401/403), routing (404), rate limit (429), or outage (5xx)
  2. 404 → update apiBase to the provider's current domain; 401/403 → renew the API key; 429 → reduce request frequency / add caching
  3. 5xx → wait and retry; check the provider's status page

Example fix

// before
if r.StatusCode() != http.StatusOK {
	return fmt.Errorf("darkibox http error: %d", r.StatusCode())
}
// after — include endpoint and body snippet for diagnosis
if r.StatusCode() != http.StatusOK {
	return fmt.Errorf("darkibox http error: %d on %s: %.200s", r.StatusCode(), endpoint, r.Body())
}
Defensive patterns

Strategy: retry

Validate before calling

if _, err := url.Parse(apiBase); err != nil {
	return errors.New("invalid darkibox apiBase")
}
if d.APIKey == "" {
	return errors.New("API key required")
}

Try / catch

if m := regexp.MustCompile(`darkibox http error: (\d+)`).FindStringSubmatch(err.Error()); m != nil {
	code, _ := strconv.Atoi(m[1])
	if code == 429 || code >= 500 { return backoffRetry() }
	if code == 401 || code == 403 { return reconfigure() }
}

Prevention

When it happens

Trigger: Any GET to apiBase+endpoint returning 401/403 (auth), 404 (wrong apiBase or endpoint renamed), 429 (rate limit), or 5xx (provider outage). Cloudflare in front of the API returning 403/503 HTML pages is a frequent cause.

Common situations: Wrong apiBase configured (provider moved domains); API key disabled; aggressive polling triggering 429; CDN/WAF challenges because the key is sent as a query parameter.

Related errors


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