firecrawl/open-lovable · error

${data.error}

Error message

${data.error}

What it means

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.

Source

Thrown at app/generation/page.tsx:2190

        addChatMessage('ZIP file created! Download starting...', 'system');
        
        const link = document.createElement('a');
        link.href = data.dataUrl;
        link.download = data.fileName || 'e2b-project.zip';
        document.body.appendChild(link);
        link.click();
        document.body.removeChild(link);
        
        addChatMessage(
          'Your Vite app has been downloaded! To run it locally:\n' +
          '1. Unzip the file\n' +
          '2. Run: npm install\n' +
          '3. Run: npm run dev\n' +
          '4. Open http://localhost:5173',
          'system'
        );
      } else {
        throw new Error(data.error);
      }
    } catch (error: any) {
      log(`Failed to create zip: ${error.message}`, 'error');
      addChatMessage(`Failed to create ZIP: ${error.message}`, 'system');
    } finally {
      setLoading(false);
    }
  };

  const reapplyLastGeneration = async () => {
    if (!conversationContext.lastGeneratedCode) {
      addChatMessage('No previous generation to re-apply', 'system');
      return;
    }
    
    if (!sandboxData) {
      addChatMessage('Please create a sandbox first', 'system');
      return;

View on GitHub (pinned to 69bd93bae7)

Solutions

  1. Read data.error in the response body — the thrown message includes it and the chat shows 'Failed to create ZIP: <reason>'
  2. Ensure code generation/apply completed successfully before exporting (sandbox files must exist)
  3. Check server logs and disk space for archiver/temp-write failures
  4. Retry the export; transient file-lock or temp-dir issues often clear
  5. Verify the export route's temp directory exists and is writable in the deployment environment

Example fix

// before
} else {
  throw new Error(data.error);
}
// after
} else {
  const reason = data?.error || 'Unknown ZIP export error';
  addChatMessage(`Retrying export... (${reason})`, 'system');
  throw new Error(reason);
}
Defensive patterns

Strategy: try-catch

Validate before calling

const res = await fetch(ZIP_EXPORT_URL, { method: 'POST', body: JSON.stringify(exportPayload) });
const data = await res.json();
if (!res.ok) throw new Error(`Export HTTP ${res.status}`);
if (!data?.success) throw new Error(data?.error || 'Export reported failure');

Type guard

interface ZipResult { success: boolean; error?: string; url?: string }
function isZipSuccess(d: unknown): d is ZipResult & { success: true; url: string } {
  return typeof d === 'object' && d !== null && (d as ZipResult).success === true && typeof (d as ZipResult).url === 'string';
}

Try / catch

try {
  const data = await res.json();
  if (!isZipSuccess(data)) throw new Error(data?.error || 'Failed to create ZIP');
  triggerDownload(data.url);
} catch (err: any) {
  log(`Failed to create zip: ${err.message}`, 'error');
  addChatMessage(`Failed to create ZIP: ${err.message}`, 'system');
} finally {
  setLoading(false);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of firecrawl/open-lovable@69bd93bae7 (2026-08-28). Data as JSON: /api/errors/2e5fa55fd711efa5. Report an issue: GitHub.