siyuan-note/siyuan · error

MiniMax image generation failed

Error message

MiniMax image generation failed

What it means

MiniMax wraps its business result in base_resp with a status_code field; 0 means success. This error is thrown when the HTTP call succeeded (2xx) but the JSON body has no base_resp, or base_resp.status_code is non-zero, meaning MiniMax's application-level API failed (e.g. invalid model, content-policy rejection, account issue). The specific MiniMax status code is not surfaced in the error message, so consult MiniMax docs for the code.

Solutions

  1. Log or capture the raw response body and check base_resp.status_code / msg against MiniMax's error-code documentation
  2. Verify the model name is a valid MiniMax image model (not an OpenAI one)
  3. Check the MiniMax account balance and API key validity in the MiniMax console
  4. If base_resp is entirely missing, confirm no proxy/gateway is intercepting the request and returning its own 200 page
  5. Retry after fixing parameters; content-filter rejections require changing the prompt
Defensive patterns

Strategy: try-catch

Validate before calling

if !slices.Contains(validMiniMaxImageModels, model) {
    return fmt.Errorf("model %q is not a MiniMax image model", model)
}

Type guard

// Go: inspect the returned error text since the MiniMax status code is not embedded
if err != nil && err.Error() == "MiniMax image generation failed" { /* fetch raw body/logs for base_resp.status_code */ }

Try / catch

data, err := generateImage(req)
if err != nil && err.Error() == "MiniMax image generation failed" {
    // check account balance, model name, prompt against content policy, then retry
    return fmt.Errorf("minimax generation rejected (check balance/model/prompt): %w", err)
}

Prevention

When it happens

Trigger: The transport received a 2xx response from /v1/image_generation whose decoded body either lacks base_resp or carries base_resp.status_code != 0 — e.g. invalid API key accepted at gateway but rejected by the service, unsupported model name, prompt blocked by content moderation, or account balance exhausted.

Common situations: Using an OpenAI-only model name (like dall-e-3) against MiniMax, a MiniMax account with insufficient balance, prompts triggering content filters, or a proxy returning 200 with a non-MiniMax body (e.g. HTML login page) so base_resp is missing.

Related errors


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/04e566a98779576e. Report an issue: GitHub.

Appendix: source

Thrown at kernel/util/minimax_image.go:111

	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] == "" {
		return nil, errors.New("MiniMax image model returned no image")
	}
	data := make([]map[string]string, 0, len(output.Data.URLs))
	for _, imageURL := range output.Data.URLs {
		data = append(data, map[string]string{"url": imageURL})
	}
	body, err = json.Marshal(map[string]any{"data": data})
	if err != nil {
		return nil, err
	}
	resp.Body = io.NopCloser(bytes.NewReader(body))
	resp.ContentLength = int64(len(body))
	resp.Header.Set("Content-Length", strconv.Itoa(len(body)))
	return resp, nil
}

View on GitHub (pinned to 9f775e8a12)