coder/code-server · warning · HttpError
Not Found
Error message
Not Found
What it means
The catch-all route handler (index.ts:176) runs after every registered route and throws HttpError 404 Not Found for any unmatched path, before the error handler renders the response. This guarantees a controlled 404 instead of Express's default 'cannot GET'.
Source
Thrown at src/node/routes/index.ts:176
app.router.use("/login", login.router)
app.router.use("/logout", logout.router)
} else {
app.router.all("/login", (req, res) => redirect(req, res, "/", {}))
app.router.all("/logout", (req, res) => redirect(req, res, "/", {}))
}
app.router.use("/update", update.router)
// For historic reasons we also load at /vscode because the root was replaced
// by a plugin in v1 of Coder. The plugin system (which was for internal use
// only) has been removed, but leave the additional route for now.
for (const routePrefix of ["/vscode", "/"]) {
app.router.use(routePrefix, vscode.router)
app.wsRouter.use(routePrefix, vscode.wsRouter.router)
}
app.router.use(() => {
throw new HttpError("Not Found", HttpCode.NotFound)
})
app.router.use(errorHandler)
app.wsRouter.use(wsErrorHandler)
return {
disposeRoutes: () => {
heart.dispose()
vscode.dispose()
},
heart,
}
}
View on GitHub (pinned to 51f90a376b)
Solutions
- Verify the URL spelling and that the route exists in this code-server version
- Update bookmarks/client base URLs to the current paths
- If the path is from a plugin, confirm the plugin is installed and its routes are registered
Example fix
// before
fetch('/loign') // 404
// after
fetch('/login') Defensive patterns
Strategy: try-catch
Validate before calling
// For clients: validate a URL is a known route before fetching
const KNOWN_PREFIXES = ["/login", "/logout", "/vscode", "/proxy", "/healthz", "/static"]
function isLikelyKnownRoute(path: string): boolean {
return KNOWN_PREFIXES.some((p) => path === p || path.startsWith(p + "/"))
} Type guard
import { HttpError, HttpCode } from "../../common/http"
function isNotFound(e: unknown): boolean {
return e instanceof HttpError && e.status === HttpCode.NotFound
} Try / catch
try {
await fetch(path)
} catch (e) {
if (isNotFound(e)) {
// show a user-friendly 404 page or correct the URL
showNotFoundPage(path)
} else throw e
} Prevention
- Maintain a list of current route prefixes for client URL builders
- After upgrades, test old bookmarks and update clients for renamed routes
- Treat 404 as expected in crawlers; do not alert on it
When it happens
Trigger: Any GET/POST/etc. to a path not matched by an earlier route: typos like /loign, removed/renamed endpoints, or stale bookmarks.
Common situations: Users with old bookmarks after an upgrade; clients hitting an endpoint removed in this version; crawlers probing arbitrary paths.
Related errors
AI-assisted analysis of coder/code-server@51f90a376b (2026-08-12).
Data as JSON: /api/errors/084ea3b840a8bb5b.
Report an issue: GitHub.