AlistGo/alist · error
gofile API error: HTTP %d - %s
Error message
gofile API error: HTTP %d - %s
What it means
Fallback Gofile API error: the response body did not parse as a Gofile error JSON (or status was not 'error'), so the driver returns 'gofile API error: HTTP <status> - <raw body>'. This is the path for HTML error pages, gateway errors, and non-JSON responses.
Source
Thrown at drivers/gofile/util.go:149
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return d.handleError(resp)
}
return nil
}
func (d *Gofile) handleError(resp *http.Response) error {
body, _ := io.ReadAll(resp.Body)
log.Debugf("Gofile API error (HTTP %d): %s", resp.StatusCode, string(body))
var errorResp ErrorResponse
if err := json.Unmarshal(body, &errorResp); err == nil && errorResp.Status == "error" {
return fmt.Errorf("gofile API error: %s (code: %s)", errorResp.Error.Message, errorResp.Error.Code)
}
return fmt.Errorf("gofile API error: HTTP %d - %s", resp.StatusCode, string(body))
}
func (d *Gofile) uploadFile(ctx context.Context, folderId string, file model.FileStreamer, up driver.UpdateProgress) (*UploadResponse, error) {
var body bytes.Buffer
writer := multipart.NewWriter(&body)
if folderId != "" {
writer.WriteField("folderId", folderId)
}
part, err := writer.CreateFormFile("file", filepath.Base(file.GetName()))
if err != nil {
return nil, err
}
// Copy with progress tracking if available
if up != nil {
reader := &progressReader{View on GitHub (pinned to 843d9dc814)
Solutions
- Read the HTTP status: 5xx -> transient, retry later; 4xx -> inspect raw body in the message for proxy/auth hints
- Test connectivity: curl -i https://api.gofile.io/getServer directly from the host
- Bypass interfering proxies / fix TLS interception for api.gofile.io
- Retry after the service recovers; no client-side config change fixes a 5xx
Defensive patterns
Strategy: retry
Type guard
func isTransientGofileHTTPError(err error) bool {
return err != nil && strings.Contains(err.Error(), "HTTP 5") && strings.Contains(err.Error(), "gofile API error")
} Try / catch
err := op.Do()
if err != nil && isTransientGofileHTTPError(err) {
// exponential backoff retry; give up after N attempts
} Prevention
- Retry only 5xx with backoff; treat 4xx bodies as configuration or proxy issues
- Whitelist api.gofile.io through TLS-intercepting proxies
When it happens
Trigger: Gofile behind Cloudflare returning a 502/504 HTML page; 5xx from api.gofile.io; body truncated by a proxy so json.Unmarshal fails; unexpected content-type on an endpoint.
Common situations: Temporary outage or maintenance of gofile.io; corporate proxy intercepting TLS and returning its own error page; CDN rate-limit challenge (HTML) instead of API JSON.
Related errors
- gofile API error: %s (code: %s)
- http request [%s] failure,status: %d response:%s
- resp.String()
- stopped after 10 redirects
- failed to get account ID: %w
AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15).
Data as JSON: /api/errors/94779e05eed28210.
Report an issue: GitHub.