CherryHQ/cherry-studio · error · Error
errorData.error?.message || 'Image generation failed'
Error message
errorData.error?.message || 'Image generation failed'
What it means
Thrown by OvmsTransport.submit() when POST {baseURL}/images/generations returns non-ok. The message comes from the JSON body's nested error.message (OVMS uses { error: { message } }), falling back to 'Image generation failed'; the .catch produces `HTTP {status}` when the body is not JSON. OVMS runs without auth, so a non-ok is a server/model problem, not auth.
Source
Thrown at src/main/ai/provider/custom/ovms/ovmsTransport.ts:60
// stripped by passthroughExtras). Native size/seed come from `input.*`.
const requestBody = {
model: input.modelId,
prompt: input.prompt ?? '',
size: input.size ?? '512x512',
num_inference_steps: typeof bag.num_inference_steps === 'number' ? bag.num_inference_steps : 4,
rng_seed: input.seed ?? 0
}
const response = await fetch(`${this.baseURL}/images/generations`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(requestBody),
signal: input.signal
})
if (!response.ok) {
const errorData = await response.json().catch(() => ({ error: { message: `HTTP ${response.status}` } }))
throw new Error(errorData.error?.message || 'Image generation failed')
}
const data = await response.json()
const items = Array.isArray(data?.data) ? data.data : []
const base64s = items
.filter((item: { b64_json?: string }) => item.b64_json)
.map((item: { b64_json: string }) => `data:image/png;base64,${item.b64_json}`)
if (base64s.length > 0) {
return { imageUrls: base64s }
}
const urls = items.filter((item: { url?: string }) => item.url).map((item: { url: string }) => item.url)
return { imageUrls: urls }
}
}
export function createOvmsTransport(settings: OvmsTransportSettings): OvmsTransport {View on GitHub (pinned to 726446b54c)
Solutions
- Confirm OVMS is running and the diffusion model is deployed (check OVMS /models endpoint or logs).
- Verify settings.imageBaseURL / DEFAULT_OVMS_BASE_URL (http://localhost:8000) actually serves /images/generations.
- Read the embedded error.message — OVMS usually names the missing model or the invalid parameter.
- Validate requestBody fields (size in WxH, num_inference_steps within model limits) before submit.
Example fix
// before
throw new Error(errorData.error?.message || 'Image generation failed')
// after — include status and host for diagnostics
throw new Error(`OVMS (${this.baseURL}) image generation failed (${response.status}): ${errorData.error?.message || response.statusText}`) Defensive patterns
Strategy: validation
Validate before calling
// Confirm OVMS is reachable and the model is deployed
const res = await fetch(`${imageBaseURL}/models`)
if (!res.ok) throw new Error(`OVMS not reachable at ${imageBaseURL}`) Type guard
export function isOvmsImageError(e: unknown): boolean {
return e instanceof Error && /Image generation failed/.test(e.message)
} Try / catch
try {
await transport.submit(input)
} catch (e) {
if (e instanceof Error) {
// surface the embedded error.message (OVMS names the missing model / bad param)
throw new Error(`OVMS image generation failed: ${e.message}`)
}
throw e
} Prevention
- Confirm the diffusion model is deployed on OVMS before image generation.
- Verify settings.imageBaseURL serves /images/generations (distinct from the chat host).
- Validate requestBody fields (size, num_inference_steps) against the model's limits.
When it happens
Trigger: The OVMS OpenVINO Model Server returns non-2xx from /images/generations. Concrete causes: the diffusion model is not loaded/deployed, OVMS not running on the configured imageBaseURL, malformed body (size/steps out of range), model crash, or wrong endpoint path.
Common situations: OVMS started without the image model deployed, imageBaseURL pointing at the chat host (which has no /images/generations), model cold-load failure, or stale OVMS version.
Related errors
- Rerank response results must contain numeric index and relev
- ModelScope API error: ${response.status} - ${errorText}
- ModelScope API request timeout after ${timeout / 1000}s
- errorData.error || 'Image generation failed'
- PPIO API error: ${response.status} - ${errorText}
AI-assisted analysis of CherryHQ/cherry-studio@726446b54c (2026-08-12).
Data as JSON: /api/errors/d7578261f86613a1.
Report an issue: GitHub.