{"record":{"id":"c3f7e41891b89928","repo":"moeru-ai/airi","slug":"failed-to-generate-image-artistryresult-error","errorCode":null,"errorMessage":"Failed to generate image: ${artistryResult.error || 'No output received'}","messagePattern":"Failed to generate image: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/stage-tamagotchi/src/renderer/stores/tools/builtin/image-journal.ts","lineNumber":109,"sourceCode":"  const title = params.title || `Generation ${new Date().toLocaleString()}`\n\n  // Resolve mode: explicit param > character fallback > global default (inline)\n  const spawnMode = cardArtistry?.spawnMode\n  const mode = params.mode || spawnMode || 'inline'\n\n  const { addWidget, generateHeadless } = getInvokers()\n\n  try {\n    const artistryResult = await generateHeadless({\n      prompt: artistryConfig.promptPrefix ? `${artistryConfig.promptPrefix} ${params.prompt}` : params.prompt as string,\n      model: artistryConfig.model as string,\n      provider: artistryConfig.provider as string,\n      options: JSON.parse(JSON.stringify(artistryConfig.options || {})),\n      globals: JSON.parse(JSON.stringify(artistryConfig.globals || {})),\n    })\n\n    if (artistryResult.error || (!artistryResult.base64 && !artistryResult.imageUrl)) {\n      throw new Error(`Failed to generate image: ${artistryResult.error || 'No output received'}`)\n    }\n\n    let blob: Blob\n    if (artistryResult.base64) {\n      const response = await fetch(artistryResult.base64)\n      blob = await response.blob()\n    }\n    else {\n      const response = await fetch(artistryResult.imageUrl!)\n      blob = await response.blob()\n    }\n\n    const entryId = await backgroundStore.addBackground('journal', blob, title, params.prompt, cardStore.activeCardId)\n\n    // Handle Application Logic based on Mode\n    if (mode === 'bg' || mode === 'bg_widget') {\n      const cardId = cardStore.activeCardId\n      if (cardId) {","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/moeru-ai/airi/blob/27111382b4a79a7e983289d6e983a06af185ed0f/apps/stage-tamagotchi/src/renderer/stores/tools/builtin/image-journal.ts#L91-L127","documentation":"Thrown when the headless artistry generation returned an error, or returned neither base64 nor imageUrl. The message embeds the upstream artistryResult.error (or 'No output received'). This is the image_journal executor wrapping any provider-level failure (network, [40]-style config, [41]-style empty output) into a single user-facing error.","triggerScenarios":"Underlying artistry provider failed: missing API key ([40]), Replicate returned no output ([41]/[43]), provider returned an error string, or the result object had no base64 and no imageUrl.","commonSituations":"Provider misconfigured (see [40]); upstream model failure (see [41]/[42]/[43]); network outage during generation; provider returned a partial result with only an error field.","solutions":["Read the embedded artistryResult.error — it names the real upstream cause; fix that first.","If error mentions a missing API key, configure the provider (see [40]).","If 'No output received', retry or switch models (see [41]).","Check network connectivity to the provider endpoint.","Verify generateHeadless invoker wiring is correct and options/globals are not malformed."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function isSuccessfulArtistryResult(r: { error?: string, base64?: string, imageUrl?: string }): boolean {\n  return !r.error && (!!r.base64 || !!r.imageUrl)\n}","tryCatchPattern":"try {\n  await executeCreateImageJournalEntry(params)\n} catch (e) {\n  const msg = e instanceof Error ? e.message : String(e)\n  // msg embeds the upstream cause; branch on known substrings\n  if (msg.includes('Missing API Key')) { /* configure provider */ }\n  else if (msg.includes('No output')) { /* retry or switch model */ }\n  else throw e\n}","preventionTips":["Pre-validate the provider is configured before calling generateHeadless.","Inspect the embedded artistryResult.error to address the root upstream cause.","Retry once for transient upstream failures."],"tags":["artistry","image-journal","upstream","tool","wrapper"],"backgroundTag":null,"analyzedSha":"27111382b4a79a7e983289d6e983a06af185ed0f","analyzedAt":"2026-08-12T18:33:34.132Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}