Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-55020

APIVersionError code name is confusing and its message is incorrect

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.9.0-alpha4
    • Component/s: None
    • Labels:
      None
    • ALL
    • Repl 2021-04-05, Repl 2021-04-19

      If I take a 4.9 server configured to allow API version 2, and I send a command requesting API version 3, I receive an error whose code name is confusing and the message is incorrect:

      serene% mongo --port 14920
      MongoDB shell version v4.4.2
      connecting to: mongodb://127.0.0.1:14920/?compressors=disabled&gssapiServiceName=mongodb
      Implicit session: session { "id" : UUID("22f6398e-eace-4944-ab13-657179ea3ac0") }
      MongoDB server version: 4.9.0-alpha5
      WARNING: shell and server versions do not match
      ---
      The server generated these startup warnings when booting: 
              2021-03-04T23:58:35.361-05:00: This is a development version of MongoDB. Not recommended for production
              2021-03-04T23:58:35.361-05:00:         version: 4.9.0-alpha5
              2021-03-04T23:58:35.361-05:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
              2021-03-04T23:58:35.361-05:00: This server is bound to localhost. Remote systems will be unable to connect to this server. Start the server with --bind_ip <address> to specify which IP addresses it should serve responses from, or with --bind_ip_all to bind to all interfaces. If this behavior is desired, start the server with --bind_ip 127.0.0.1 to disable this warning
              2021-03-04T23:58:35.362-05:00: /sys/kernel/mm/transparent_hugepage/enabled is 'always'. We suggest setting it to 'never'
              2021-03-04T23:58:35.362-05:00: Soft rlimits for open file descriptors too low
              2021-03-04T23:58:35.362-05:00:         currentValue: 4010
              2021-03-04T23:58:35.362-05:00:         recommendedMinimum: 64000
      ---
      MongoDB Enterprise ruby-driver-rs:PRIMARY> db.runCommand({ping:1,apiVersion:'3'})
      {
      	"ok" : 0,
      	"errmsg" : "API version must be \"1\"",
      	"code" : 322,
      	"codeName" : "APIVersionError",
      	"$clusterTime" : {
      		"clusterTime" : Timestamp(1615066282, 1),
      		"signature" : {
      			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
      			"keyId" : NumberLong(0)
      		}
      	},
      	"operationTime" : Timestamp(1615066282, 1)
      }
      MongoDB Enterprise ruby-driver-rs:PRIMARY> db.runCommand({ping:1,apiVersion:'2'})
      {
      	"ok" : 1,
      	"$clusterTime" : {
      		"clusterTime" : Timestamp(1615066282, 1),
      		"signature" : {
      			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
      			"keyId" : NumberLong(0)
      		}
      	},
      	"operationTime" : Timestamp(1615066282, 1)
      }
      
      • Is APIVersionError the code name for specifying an unknown API version, or an umbrella code name for all API version-related errors (such as specifying an API version that the server acknowledges as existing, but does not support, i.e. version 1 at some point in the future)?
      • The message returned is wrong. The server accepts API version 2, therefore requesting version 1 is incorrect.

      As a user of the server, I would like:

      • The server to provide clear labeling of the errors, and distinguish between a specific error and a category of errors. For example, a better error code name would be UnknownAPIVersion.
      • The server to report the error first and then, optionally, suggest a course of action to fix it. Specifically in this case I would like the server say that the provided API version was not recognized, and then say that the recognized versions are 1 and 2.

      Tested against 4.9.0-alpha5 which isn't in the version selector.

            Assignee:
            jason.chan@mongodb.com Jason Chan
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: