{"record":{"id":"d7578261f86613a1","repo":"CherryHQ/cherry-studio","slug":"errordata-error-message-image-generation-fail","errorCode":null,"errorMessage":"errorData.error?.message || 'Image generation failed'","messagePattern":"errorData\\.error\\?\\.message \\|\\| 'Image generation failed'","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/ai/provider/custom/ovms/ovmsTransport.ts","lineNumber":60,"sourceCode":"    // stripped by passthroughExtras). Native size/seed come from `input.*`.\n    const requestBody = {\n      model: input.modelId,\n      prompt: input.prompt ?? '',\n      size: input.size ?? '512x512',\n      num_inference_steps: typeof bag.num_inference_steps === 'number' ? bag.num_inference_steps : 4,\n      rng_seed: input.seed ?? 0\n    }\n\n    const response = await fetch(`${this.baseURL}/images/generations`, {\n      method: 'POST',\n      headers: { 'Content-Type': 'application/json' },\n      body: JSON.stringify(requestBody),\n      signal: input.signal\n    })\n\n    if (!response.ok) {\n      const errorData = await response.json().catch(() => ({ error: { message: `HTTP ${response.status}` } }))\n      throw new Error(errorData.error?.message || 'Image generation failed')\n    }\n\n    const data = await response.json()\n    const items = Array.isArray(data?.data) ? data.data : []\n\n    const base64s = items\n      .filter((item: { b64_json?: string }) => item.b64_json)\n      .map((item: { b64_json: string }) => `data:image/png;base64,${item.b64_json}`)\n    if (base64s.length > 0) {\n      return { imageUrls: base64s }\n    }\n\n    const urls = items.filter((item: { url?: string }) => item.url).map((item: { url: string }) => item.url)\n    return { imageUrls: urls }\n  }\n}\n\nexport function createOvmsTransport(settings: OvmsTransportSettings): OvmsTransport {","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/CherryHQ/cherry-studio/blob/726446b54cd69ffe51a276638672f6d95ca0768c/src/main/ai/provider/custom/ovms/ovmsTransport.ts#L42-L78","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nthrow new Error(errorData.error?.message || 'Image generation failed')\n// after — include status and host for diagnostics\nthrow new Error(`OVMS (${this.baseURL}) image generation failed (${response.status}): ${errorData.error?.message || response.statusText}`)","handlingStrategy":"validation","validationCode":"// Confirm OVMS is reachable and the model is deployed\nconst res = await fetch(`${imageBaseURL}/models`)\nif (!res.ok) throw new Error(`OVMS not reachable at ${imageBaseURL}`)","typeGuard":"export function isOvmsImageError(e: unknown): boolean {\n  return e instanceof Error && /Image generation failed/.test(e.message)\n}","tryCatchPattern":"try {\n  await transport.submit(input)\n} catch (e) {\n  if (e instanceof Error) {\n    // surface the embedded error.message (OVMS names the missing model / bad param)\n    throw new Error(`OVMS image generation failed: ${e.message}`)\n  }\n  throw e\n}","preventionTips":["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."],"tags":["ovms","image-generation","network","local-server"],"backgroundTag":null,"analyzedSha":"726446b54cd69ffe51a276638672f6d95ca0768c","analyzedAt":"2026-08-12T17:30:37.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}