[SERVER-41365] Improve unhelpful error "ns not found" Created: 28/May/19  Updated: 21/May/20  Resolved: 20/May/20

Status: Closed
Project: Core Server
Component/s: Storage, Usability
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Dan Dascalescu Assignee: Dianna Hohensee (Inactive)
Resolution: Won't Do Votes: 0
Labels: neweng, pull-request
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by DRIVERS-745 Specify how drivers handle "ns not fo... Closed
is depended on by DRIVERS-1253 Make dropIndexes abort in-progress in... Closed
Problem/Incident
Related
related to CDRIVER-3655 Tests checking for "ns not found" mus... Closed
related to SERVER-43894 Make dropping a nonexistent collectio... Closed
is related to DOCS-13268 Verify/update definition of "namespace" Closed
Sprint: Execution Team 2020-05-04, Execution Team 2020-05-18, Execution Team 2020-06-01
Participants:
Linked BF Score: 0

 Description   

https://stackoverflow.com/questions/37136204/mongoerror-ns-not-found-when-try-to-drop-collection

Mongo should say WHICH collection was not found.



 Comments   
Comment by Matt Broadstone [ 21/May/20 ]

Hi dandv,
We're going to fix this issue in the Node.js driver, so you will likely never see the message again once that version is released. The goal of swallowing this error client-side is to provide parity with the server's behavior of automatically creating collections if you try to insert data into one which doesn't exist; you don't see an ns `foo` not found error when you try to do that. Hopefully this will be a non-issue for you and people on stack overflow soon.

Comment by Dan Dascalescu [ 20/May/20 ]

Understandable, but sad to see that due to some unreliably designed old drivers, all current developers have to get confused by this error.

Comment by Dianna Hohensee (Inactive) [ 20/May/20 ]

Closing this as Won't Do. Discussed via email with the Drivers team, and they will take on the work to surface an improved error message to the end user. Server will not be making any changes to the error message because it would break compatibility with old driver versions that depend upon an exact string match. It was agreed that DRIVERS-745 will be re-tasked for the relevant work.

Comment by Dianna Hohensee (Inactive) [ 14/May/20 ]

Our commit hook didn't fire for some reason. Writing it myself
--------------------------------------
Author:

{'name': 'Dianna Hohensee', 'email': 'dianna.hohensee@mongodb.com', 'username': 'dianna.hohensee'}

Message: Revert "SERVER-41365 include the particular namespace in 'ns not found' error messages"

This reverts commit 485fdf001d39c7f809ead645d5d892b5094e9431.
Branch: master
https://github.com/mongodb/mongo/commit/4ad639d67072c0dfa0e25289b7b938c2c72b209e

Comment by Dianna Hohensee (Inactive) [ 14/May/20 ]

It turns out errInfo does not get returned in the relevant command responses. Reverting the change that breaks downstream for now.

Comment by Eric Milkie [ 07/May/20 ]

Let's consider using errInfo instead of changing the error message itself for this, to avoid breaking drivers.

Comment by Githook User [ 05/May/20 ]

Author:

{'name': 'William Reiske', 'email': 'wreiske@mieweb.com', 'username': 'wreiske'}

Message: SERVER-41365 include the particular namespace in 'ns not found' error messages
Branch: master
https://github.com/mongodb/mongo/commit/485fdf001d39c7f809ead645d5d892b5094e9431

Comment by Oleg Pudeyev (Inactive) [ 08/Oct/19 ]

FYI, Ruby and potentially other drivers perform substring matches looking for the phrase "ns not found" to handle these errors specially (such as ignoring them when trying to drop collections). As long as dropping a nonexistent collection is an error (but I filed SERVER-43894 to potentially change this), for backwards compatibility it will be good if the server maintained the string "ns not found" in the error message in addition to the helpful diagnostics such as "collection foo does not exist".

Comment by Dan Dascalescu [ 29/May/19 ]

While it wasn't extremely difficult to determine which collection the error was about, it's a matter of Writing Good Error Messages 101 to make errors as helpful as possible.

First off, I had no idea what "ns" meant. I had to Google the error. This is a sign of failure on the part of the error.
A good error message does not force the developer to Google it. 
Collection foo does not exist", would have saved me and thousands* of StackOverflow users quite a bit of time.

Second, there's no stack trace pointing to client code. This makes it harder to pinpoint the line that caused the error.

 Apologies for filing the ticket under the Node Driver. Please move to the appropriate SERVER component.

  • That SO question has 29 upvotes and the answer has 43 upvotes. The 1% Internet rule suggests that 100x as many people may have searched for it without upvoting.
Comment by Matt Broadstone [ 29/May/19 ]

Hi dandv,

Thanks for your report. The error you're running into is actually from the server, and it's one of our drivers mantras to depend on relaying server message when possible. Was it difficult to determine which collection failed from the backtrace of the error? I would recommend opening a SERVER ticket if you feel there would be value to displaying the failed namespace in the error.

Generated at Thu Feb 08 04:57:31 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.