NOT_FOUND
gRPCERRORCommonClient-SideHIGH confidence

A requested entity was not found

What this means

Indicates that a specific entity requested by the client (e.g., a file or a database record) was not found. The operation can be retried if the entity might be created later.

Why it happens
  1. 1The client requested an entity with an ID that does not exist.
  2. 2The entity was deleted between the time the client learned of it and when it made the request.
  3. 3The client is connected to the wrong environment (e.g., staging instead of production) where the data does not exist.
How to reproduce

A client requests a user profile with an ID that is not in the database.

trigger — this will error
trigger — this will error
// Client requests a user with a non-existent ID
try {
  await client.getUser({ userId: "user-does-not-exist-123" });
} catch (e) {
  // e.code will be grpc.status.NOT_FOUND
}

expected output

StatusCode.NOT_FOUND: A requested entity was not found

Fix 1

Check the Request ID

WHEN When this error is unexpected.

Check the Request ID
// Ensure the ID being sent by the client is correct
const userId = getUserIdFromUI(); // "user-does-not-exist-123"
// Verify this ID is valid before sending the request
if (isValidUUID(userId)) {
  await client.getUser({ userId });
}

Why this works

Validate that the identifier being used in the request is correct and well-formed.

Fix 2

Handle Gracefully in the UI

WHEN When it is a valid outcome that an entity might not exist.

Handle Gracefully in the UI
try {
  const user = await client.getUser({ userId });
  displayUser(user);
} catch (e) {
  if (e.code === grpc.status.NOT_FOUND) {
    displayUserNotFoundMessage();
  }
}

Why this works

In many cases, NOT_FOUND is a normal part of application flow and should be handled by presenting a user-friendly message.

What not to do

Retry the request in a tight loop

Unless there's a specific reason to believe the resource will be created imminently, retrying a NOT_FOUND error will just waste resources.

Sources

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All gRPC errors