siyuan-note/siyuan · error

MiniMax image model returned no image

Error message

MiniMax image model returned no image

What it means

After MiniMax reports success (base_resp.status_code == 0), the transport checks that data.image_urls contains at least one non-empty URL. If the array is empty or the first URL is an empty string, it throws this error: the API said the generation succeeded but produced no usable image reference.

Solutions

  1. Ensure the request sets n >= 1 (the OpenAI-style request's n field is forwarded verbatim)
  2. Retry the generation — transient degenerate successes usually resolve
  3. Change or simplify the prompt and size/aspect_ratio parameters and try again
  4. Check MiniMax service status or announcements for incidents affecting image generation
  5. If persistent, capture the raw response and report it to MiniMax support

Example fix

// before
{"model":"image-01","prompt":"a cat","n":0}
// after
{"model":"image-01","prompt":"a cat","n":1}
Defensive patterns

Strategy: retry

Validate before calling

if n <= 0 {
    n = 1 // MiniMax returns empty image_urls when n is 0
}

Try / catch

for attempt := 0; attempt < 3; attempt++ {
    data, err = generateImage(req)
    if err == nil || err.Error() != "MiniMax image model returned no image" {
        break
    }
    time.Sleep(backoff(attempt))
}

Prevention

When it happens

Trigger: A 2xx MiniMax /image_generation response with status_code 0 but an empty or missing data.image_urls array — typically when the requested n is 0 or unset in the converted payload, or MiniMax returns a degenerate success response.

Common situations: Calling image generation with n explicitly set to 0, an unusual aspect/size combination MiniMax silently fails to render, or transient MiniMax-side issues where success is reported without output.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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

Appendix: source

Thrown at kernel/util/minimax_image.go:114

	}
	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)