siyuan-note/siyuan · error
MiniMax image request failed with HTTP status
Error message
MiniMax image request failed with HTTP status %d
What it means
The MiniMax image transport (miniMaxImageTransport.Do) converts OpenAI-style /images/generations requests into MiniMax /image_generation calls. After issuing the converted HTTP request it checks the response status code; anything outside 200-299 is rejected with this error and the response body is closed and discarded. It means the MiniMax API endpoint refused the request at the HTTP level, so no image payload is available.
Solutions
- Check the HTTP status logged with the error: 401/403 means fix the MiniMax API key in the AI provider settings
- 429 means rate limiting — retry with backoff or reduce request frequency
- 400 means the request payload was rejected — verify the model name and size (WIDTHxHEIGHT) are valid for MiniMax
- 5xx means a MiniMax-side problem — retry later; the response body containing the detailed error message was discarded, so enable request logging if you need the detail
- Confirm network/proxy settings allow reaching the MiniMax host
Defensive patterns
Strategy: try-catch
Validate before calling
u, _ := url.Parse(baseURL)
if u == nil || u.Scheme != "https" || !strings.HasSuffix(strings.TrimRight(u.Path, "/"), "/v1") {
return fmt.Errorf("base URL must be https://api.minimax.{io,cn}/v1")
}
if apiKey == "" {
return fmt.Errorf("MiniMax API key is required")
} Type guard
// Go: check the concrete error shape
var mmErr interface{ Error() string }
if errors.As(err, &mmErr) && strings.HasPrefix(mmErr.Error(), "MiniMax image request failed with HTTP status ") { /* handle 4xx/5xx */ } Try / catch
data, err := generateImage(req)
if err != nil {
if strings.Contains(err.Error(), "HTTP status 401") || strings.Contains(err.Error(), "HTTP status 403") {
return fmt.Errorf("check MiniMax API key: %w", err)
}
if strings.Contains(err.Error(), "HTTP status 429") {
// retry with backoff
}
return err
} Prevention
- Validate the MiniMax API key before deploying
- Keep request frequency under MiniMax rate limits
- Verify the base URL is an official MiniMax host with a /v1 path
- Log status codes and correlate with MiniMax's error-code docs
When it happens
Trigger: Calling the AI image-generation flow with a MiniMax base URL (api.minimax.io/api.minimax.cn/api.minimaxi.com with /v1 path) when MiniMax returns 4xx/5xx: invalid or missing API key (401), malformed request parameters (400), quota exhausted (429), or MiniMax server errors (5xx).
Common situations: Developers enter an expired or wrong MiniMax API key, use an unsupported model name, send an invalid size string after transport conversion, or hit MiniMax rate limits during bursts of image generation.
Understand the failure class
Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.
Related errors
- authentication probe returned HTTP " + response.status
- boot progress request returned HTTP " + response.status
- discover OIDC provider failed
- download custom emoji failed
- download custom emoji failed with status
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/83fdccad6112b8ed.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/util/minimax_image.go:95
payload["width"], payload["height"] = width, height
}
body, err := json.Marshal(payload)
if err != nil {
return nil, err
}
converted := req.Clone(req.Context())
converted.URL.Path = strings.TrimSuffix(req.URL.Path, "/images/generations") + "/image_generation"
converted.URL.RawPath = ""
converted.Body = io.NopCloser(bytes.NewReader(body))
converted.ContentLength = int64(len(body))
converted.GetBody = func() (io.ReadCloser, error) { return io.NopCloser(bytes.NewReader(body)), nil }
resp, err := t.base.Do(converted)
if err != nil {
return nil, err
}
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
resp.Body.Close()
return nil, fmt.Errorf("MiniMax image request failed with HTTP status %d", resp.StatusCode)
}
var output struct {
Data struct {
URLs []string `json:"image_urls"`
} `json:"data"`
BaseResp *struct {
StatusCode int `json:"status_code"`
} `json:"base_resp"`
}
err = json.NewDecoder(io.LimitReader(resp.Body, 1024*1024)).Decode(&output)
resp.Body.Close()
if err != nil {
return nil, err
}
if output.BaseResp == nil || output.BaseResp.StatusCode != 0 {
return nil, errors.New("MiniMax image generation failed")
}
if len(output.Data.URLs) == 0 || output.Data.URLs[0] == "" {View on GitHub (pinned to 9f775e8a12)