HTTP 404 Not Found vs gRPC 5 NOT_FOUND
HTTP 404 and gRPC NOT_FOUND both indicate a missing resource, but they operate in fundamentally different communication models. HTTP 404 applies to URL-addressed resources in a request-response cycle, while gRPC NOT_FOUND applies to entities referenced within RPC method parameters.
説明
The server cannot find the requested resource. The URL may be wrong, the resource may have been deleted, or it may never have existed.
このコードが表示される場合
When a URL is mistyped, a page has been deleted, or an API endpoint doesn't exist.
修正方法
Verify the URL is correct. Check for typos, case sensitivity, and trailing slashes.
説明
Some requested entity was not found. For example, a file or directory that the RPC was supposed to operate on does not exist.
このコードが表示される場合
The resource referenced in the request doesn't exist — such as looking up a user by ID that has been deleted or never created.
修正方法
Verify the resource identifier is correct. Ensure the resource was created before accessing it, or handle the not-found case gracefully in your client.
主な違い
HTTP 404 means the URL itself does not map to any resource — the path does not exist.
gRPC NOT_FOUND means the entity referenced in the RPC request (by ID, name, etc.) was not found.
HTTP 404 can be cached by browsers and CDNs; gRPC NOT_FOUND is not cached at the transport layer.
HTTP 404 is often used to hide resources from unauthorized users (instead of 403); gRPC uses PERMISSION_DENIED separately.
gRPC NOT_FOUND is returned as a trailer in the HTTP/2 stream, not as an HTTP-level status code.
使い分け方
Use HTTP 404 when a URL path does not match any route or the addressed resource does not exist. Use gRPC NOT_FOUND when a lookup by ID, key, or name within an RPC method yields no result. In API gateways that translate between HTTP and gRPC, map gRPC NOT_FOUND to HTTP 404.