AI Fails
When the LLM gets it wrong
Last Updated: 2026-07-31
Google Search, Gemini AI Summary - A 404 at best, unencrypted HTTP more likely
I search Google for node request get local path. Its AI summary provided the following code:
- const http = require('http');
- http.createServer((req, res) => {
- // Pass a dummy base URL to parse relative request paths safely
- const requestUrl = new URL(req.url, `http://${req.headers.host}`);
- const localPath = requestUrl.pathname;
-
- console.log(localPath); // Outputs: "/users" (instead of "/users?id=123")
- res.end(`Path requested: ${localPath}`);
- }).listen(3000);
It hard coded the protocol. The correct code is:
By "correct" I mean in the context of this example which is a pretty absurb approach.
Playing devils advocate I "should" have searched node express request get local path:
The point is where is the intelligence to suggest using Express in the first query response? No one should be using unencrypted HTTP as of at least a decade ago. Adding insult to injury the example uses CommonJS syntax.