{"record":{"id":"2e5fa55fd711efa5","repo":"firecrawl/open-lovable","slug":"data-error","errorCode":null,"errorMessage":"${data.error}","messagePattern":"\\$\\{data\\.error\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/generation/page.tsx","lineNumber":2190,"sourceCode":"        addChatMessage('ZIP file created! Download starting...', 'system');\n        \n        const link = document.createElement('a');\n        link.href = data.dataUrl;\n        link.download = data.fileName || 'e2b-project.zip';\n        document.body.appendChild(link);\n        link.click();\n        document.body.removeChild(link);\n        \n        addChatMessage(\n          'Your Vite app has been downloaded! To run it locally:\\n' +\n          '1. Unzip the file\\n' +\n          '2. Run: npm install\\n' +\n          '3. Run: npm run dev\\n' +\n          '4. Open http://localhost:5173',\n          'system'\n        );\n      } else {\n        throw new Error(data.error);\n      }\n    } catch (error: any) {\n      log(`Failed to create zip: ${error.message}`, 'error');\n      addChatMessage(`Failed to create ZIP: ${error.message}`, 'system');\n    } finally {\n      setLoading(false);\n    }\n  };\n\n  const reapplyLastGeneration = async () => {\n    if (!conversationContext.lastGeneratedCode) {\n      addChatMessage('No previous generation to re-apply', 'system');\n      return;\n    }\n    \n    if (!sandboxData) {\n      addChatMessage('Please create a sandbox first', 'system');\n      return;","sourceCodeStart":2172,"sourceCodeEnd":2208,"githubUrl":"https://github.com/firecrawl/open-lovable/blob/69bd93bae7a9c97ef989eb70aabe6797fb3dac89/app/generation/page.tsx#L2172-L2208","documentation":"Thrown when the ZIP-export endpoint responds with HTTP 200 but its JSON body indicates failure via data.error (data.success falsy with an error field). The export pipeline (bundling the generated project for download) failed server-side and reported the reason in the payload. The catch block logs it and surfaces 'Failed to create ZIP: ...' to the chat.","triggerScenarios":"POST to the zip/export route returns { success: false, error: '...' }: server-side archiver failure, project files missing on disk for the sandbox, filesystem permission issues, or payload/route validation rejecting the request.","commonSituations":"Sandbox files were never written (user exports before generation completes); disk full on the server during zip streaming; archiver chokes on an unexpected file (symlink, odd filename); route deployed without write permissions to its temp directory; exporting an empty/newly-created project.","solutions":["Read data.error in the response body — the thrown message includes it and the chat shows 'Failed to create ZIP: <reason>'","Ensure code generation/apply completed successfully before exporting (sandbox files must exist)","Check server logs and disk space for archiver/temp-write failures","Retry the export; transient file-lock or temp-dir issues often clear","Verify the export route's temp directory exists and is writable in the deployment environment"],"exampleFix":"// before\n} else {\n  throw new Error(data.error);\n}\n// after\n} else {\n  const reason = data?.error || 'Unknown ZIP export error';\n  addChatMessage(`Retrying export... (${reason})`, 'system');\n  throw new Error(reason);\n}","handlingStrategy":"try-catch","validationCode":"const res = await fetch(ZIP_EXPORT_URL, { method: 'POST', body: JSON.stringify(exportPayload) });\nconst data = await res.json();\nif (!res.ok) throw new Error(`Export HTTP ${res.status}`);\nif (!data?.success) throw new Error(data?.error || 'Export reported failure');","typeGuard":"interface ZipResult { success: boolean; error?: string; url?: string }\nfunction isZipSuccess(d: unknown): d is ZipResult & { success: true; url: string } {\n  return typeof d === 'object' && d !== null && (d as ZipResult).success === true && typeof (d as ZipResult).url === 'string';\n}","tryCatchPattern":"try {\n  const data = await res.json();\n  if (!isZipSuccess(data)) throw new Error(data?.error || 'Failed to create ZIP');\n  triggerDownload(data.url);\n} catch (err: any) {\n  log(`Failed to create zip: ${err.message}`, 'error');\n  addChatMessage(`Failed to create ZIP: ${err.message}`, 'system');\n} finally {\n  setLoading(false);\n}","preventionTips":["Only enable export after code generation/apply has succeeded (sandbox files exist)","Validate the endpoint's JSON shape before using it (success flag + url)","Check server disk space and temp-dir permissions where zips are built","Keep the finally { setLoading(false) } so UI never sticks on failure","Retry transient export failures once before reporting to the user"],"tags":["zip","export","api-response","filesystem"],"backgroundTag":"api-error-payload","analyzedSha":"69bd93bae7a9c97ef989eb70aabe6797fb3dac89","analyzedAt":"2026-08-28T22:20:32.339Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}