E: Unable to Locate Package MongoDB Mongosh: Causes and Proven Fixes
The apt error E: Unable to locate package mongodb-mongosh almost always points to a missing or mismatched MongoDB repository. Here is how to diagnose and fix it.

If you run sudo apt install mongodb-mongosh on Ubuntu or Debian and get back E: Unable to locate package mongodb-mongosh, your system is not broken and the package name is not wrong. The error simply means apt searched every repository index it currently knows about and found no package with that exact name. mongosh is MongoDB's modern shell (the replacement for the legacy mongo shell removed in MongoDB 6.0), and it is not published in the default Ubuntu or Debian archives at all. It ships only from MongoDB's own APT repository, from a downloadable .deb, or from npm. So this error is nearly always a repository configuration problem: a missing source list, a codename mismatch, a GPG keyring that apt refuses to trust, or an apt update that was never run after adding the source.
Quick Answer: The error means apt cannot find mongodb-mongosh in any enabled repository, because mongosh is not in the default Ubuntu or Debian archives. Fix it by adding MongoDB's official APT repository with a valid GPG keyring and the correct OS codename, running
sudo apt update, then reinstalling the package.
How WebPeak Helps Teams Keep Database Environments Stable
Errors like this one rarely happen in isolation. They surface during server provisioning, a Node.js deployment, or a migration from a self-hosted MongoDB instance to a managed cluster, which is exactly where an experienced engineering partner saves days of trial and error. The team at works with MongoDB-backed applications daily and treats shell tooling, repository pinning, and version compatibility as part of a repeatable provisioning process rather than a one-off fix. Their cover repository hardening and reproducible server builds, while their team keeps driver, server, and mongosh versions aligned so a working local environment does not break in production.

