/Knowledge/sources/honojs__hono/llms-full/rpc-not-found--part-03--20428152b7b8.md
RPC: Not Found (part 03) - hono-docs
RPC: Not Found (part 03) Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt not found Summary Alternative...
RPC: Not Found (part 03)
Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#not-found
Summary
Alternatively, you can use module augmentation to extend NotFoundResponse interface. This allows c.notFound() to return a typed response: ```ts // server.ts import { Hono, TypedResponse } from 'hono' declare module 'hono' { interface...
Content
Alternatively, you can use module augmentation to extend NotFoundResponse interface. This allows c.notFound() to return a typed response:
// server.ts
import { Hono, TypedResponse } from 'hono'
declare module 'hono' {
interface NotFoundResponse
extends Response,
TypedResponse<{ error: string }, 404, 'json'> {}
}
const app = new Hono()
.get('/posts/:id', async (c) => {
const post = await getPost(c.req.param('id'))
if (!post) {
return c.notFound()
}
return c.json({ post }, 200)
})
.notFound((c) => c.json({ error: 'not found' }, 404))
export type AppType = typeof app
Now the client can correctly infer the 404 response type.
Metadata
{
"chunk_index": 2,
"citation": "https://hono.dev/llms-full.txt#not-found",
"coverage_role": "overview",
"qualified_title": "Hono / llms-full / RPC > Not Found (3)",
"retrieved_at": "2026-07-02T05:51:01Z",
"section_index": 52,
"source_id": "/honojs/hono",
"source_type": "llms_full",
"target_label": "llms-full",
"title": "RPC: Not Found (part 03)",
"upstream_url": "https://hono.dev/llms-full.txt",
"version": "2026"
}