今日已更新 233 条资讯 | 累计 20205 条内容
关于我们

Why Error Messages Matter More in the Age of AI

Sean Boult 2026年07月10日 20:45 2 次阅读 来源:Dev.to

Everyone talks about AI writing code. Nobody talks about AI debugging code. Bad error messages are the worst, we've all seen them. You open the logs or run your program and see something like this... Error: something went wrong It leaves you asking: What happened? Where did it happen? Why did it happen? How do I fix it? You might have written some of these pretty silly error messages, I know I have. They don't help us fix software quickly because we first have to figure out why the error happened. Rust has been shipping fantastic error messages for years. Take this example where I accidentally call println instead of println! . $ cargo run 101 ↵ Compiling ducksay v0.2.0 (~/oss/ducksay) error[E0423]: expected function, found macro `print` --> src/main.rs:51:3 | 51 | print("{}", render_with_style(&message, cli.width.get(), style)); | ^^^^^ not a function | help: use `!` to invoke the macro | 51 | print!("{}", render_with_style(&message, cli.width.get(), style)); | It's fantastic! It tells you what went wrong, where it occurred, and how to fix it. When you're building software, you should make your error messages exceptional (punny 😂). Here's another example from Vite+ where I had a syntax error in the config file. $ vp dev failed to load config from ~/oss/test-ssr-on-aws/vite.config.ts error when starting dev server: Error: Build failed with 1 error: [PARSE_ERROR] Error: Unexpected token ╭─[ vite.config.ts:5:3 ] │ 5 │ , │ ┬ │ ╰── ───╯ Now imagine debugging code with generic error messages that tell you absolutely nothing helpful. You'll have to manually trace through the code to figure out what the heck is going on. AI agents run into the same problem. If the error tells them almost nothing, they have to spend extra time reading files, tracing execution paths, and making additional tool calls just to understand what failed. So what can we do to help humans and AI? Here are some of my top recommendations for writing good error messages. 1. Be descriptive and specific W

本文内容来源于互联网,版权归原作者所有
查看原文