DEV Community

Akriti Keswani
Akriti Keswani

Posted on

Debug Smarter: Multimodal Error Analysis for Next.js with Daft.ai

Late-night debugging? We've all been there.

It’s 11 PM on a Thursday. You should be winding down, but your Next.js app is throwing cryptic hydration errors and 500s are flooding your logs. Your desktop’s cluttered with screenshots and log files, and you're hopping between ChatGPT, Claude, and Cursor hoping someone (or something) can help you connect the dots.

But nothing clicks. The AI doesn’t seem to understand that the broken UI might be linked to that failed API call you saw 10 minutes ago. And now you’re the one trying to piece together the story from screenshots, console logs, and error messages. If this sounds familiar, you're not alone—and you’re definitely not doing anything wrong. The reality is: debugging multimodal errors (text + visual + structured data) is still way harder than it should be.

So, what if you could search your error data like a knowledge base? What if you could say, “Show me all auth errors with matching screenshots,” and get a real answer? In this tutorial, we’ll show you how to do exactly that—with Daft.ai, a framework built to handle and analyze structured + unstructured data at scale. We'll walk through how to:

• Load and process error logs and screenshots
• Generate embeddings for both text and images using UDFs
• Run semantic + similarity search across modalities
• Get insights and recommendations - all from one place

Let’s build a better way to debug!

What We're Building

By the end of this post, you’ll have a fully working multimodal debugging tool that can:

• Ingest logs and screenshots
• Generate embeddings using Daft.ai's UDFs
• Classify errors automatically
• Run similarity search across both text and images
• Answer RAG-style queries with actual context

Step 1: Organize Your Error Data

Start by structuring your Next.js error artifacts like this:

nextjs_errors/
├── screenshots/
│   ├── auth_error.png
│   ├── hydration_error.png
│   ├── runtime_error.png
│   └── build_error.png
└── logs/
    ├── api_auth_error.txt
    ├── hydration_error.txt
    ├── runtime_error.txt
    └── build_error.txt
Enter fullscreen mode Exit fullscreen mode

These can be pulled from Sentry, your browser dev tools, Vercel logs—
wherever your pain lives.

Step 2: Load Logs + Screenshots into Daft

Step 3: Embed Your Data (Text + Image)

Now we’ll write custom UDFs (user-defined functions) to simulate embeddings. These help Daft understand the meaning behind each log or screenshot:

Note: In production, you'd replace these with actual embedding models like OpenAI's text-embedding-ada-002 or CLIP for images.

Step 4: Classify Errors Automatically

Let’s tag our logs with some basic intelligence:

Step 5: Run RAG Queries

You can now run natural queries like:

Step 6: Search for Similar Errors

Want to find logs or screenshots that look like the one you just debugged? Use cosine similarity across your embeddings:

Results

What's Next?

In this tutorial, I chose Next.js as the focus because it's where I spend most of my time as a developer, and honestly, it's where I have the most fun building. But beyond personal passion, the numbers tell a compelling story: with over 5 million developers using Next.js weekly, we're talking about a massive chunk of the global developer experience that's still stuck in manual debugging workflows.
Every week, millions of developers are doing exactly what I described in the intro—copying screenshots into AI assistants, losing context between logs and visual breakdowns, manually connecting dots that should be automated. The scale of this inefficiency is staggering when you think about it globally.

That's what excites me most about this project. We've built a functional multimodal error analysis pipeline with Daft.ai that demonstrates:

• Custom UDFs for embedding generation
• Classification of real-world Next.js error patterns
• Embedding similarity search across modalities
• RAG-style queries over multimodal error datasets
• Insight generation with actionable debugging recommendations

This isn't just a cool technical demo—it's a proof of concept for streamlining debugging workflows for millions of developers. The foundation shows what's possible when you combine Daft's UDF capabilities with real developer pain points at scale.

Final Thoughts

Instead of manually copying screenshots into Cursor and losing context, you can now process your error data programmatically and find patterns across both text logs and visual breakdowns. With Daft.ai, your debugging workflow becomes data-driven—and that efficiency multiplied across developers could fundamentally change how we approach debugging.

👉 See full code on Github!

Top comments (0)