/Knowledge/sources/honojs__hono/llms-full/rpc-not-found--1d7e8b120a2d.md
RPC: Not Found - hono-docs
RPC: Not Found Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt not found Summary If you want to use a...
RPC: Not Found
Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#not-found
Summary
If you want to use a client, you should not use c.notFound() for the Not Found response. The data that the client gets from the server cannot be inferred correctly. ```ts // server.ts export const routes = new Hono().get( '/posts', zVa...
Content
If you want to use a client, you should not use c.notFound() for the Not Found response. The data that the client gets from the server cannot be inferred correctly.
// server.ts
export const routes = new Hono().get(
'/posts',
zValidator(
'query',
z.object({
id: z.string(),
})
),
async (c) => {
const { id } = c.req.valid('query')
const post: Post | undefined = await getPost(id)
if (post === undefined) {
return c.notFound() // ❌️
}
return c.json({ post })
}
)
// client.ts
import { hc } from 'hono/client'
const client = hc<typeof routes>('/')
const res = await client.posts[':id'].$get({
param: {
id: '123',
},
})
const data = await res.json() // 🙁 data is unknown
Please use c.json() and specify the status code for the Not Found Response.
Metadata
{
"chunk_index": 0,
"citation": "https://hono.dev/llms-full.txt#not-found",
"coverage_role": "overview",
"qualified_title": "Hono / llms-full / RPC > Not Found (1)",
"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",
"upstream_url": "https://hono.dev/llms-full.txt",
"version": "2026"
}