Uploaded image for project: 'Couchbase Documentation'
  1. Couchbase Documentation
  2. DOC-12321

Add docs for finderr tool and builtin function

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Unresolved
    • Major
    • 7.6.4
    • 7.6.3
    • query
    • None
    • 0

    Description

      There are two ways to look up error messages:
      i. finderr tool (located at the bin directory)
      ii. finderr built-in function (mainly for the benefit of Capella users, but available to all)

      functionality: display static messages from https://github.com/couchbase/query/blob/trinity/errors/messages.go 

      In the code, the details recorded for the messages are:

      • Code: number that represents the error (displayed/returned)
      • Symbol: internal representation string for the error (this is not displayed but can be searched on; this is for internal use)
      • Description: message on why the error occurred (displayed/returned)
      • Reason: list of possible causes of how the error may have been hit (displayed/returned)
      • Action: list of possible steps a user can take to mitigate the error (displayed/returned)
      • IsUser: YES(caused by user), NO(caused by other services or internal to the server), MAYBE(combination of both) (displayed as "user_error"/"USER ERROR")
      • Applies to: cbq-shell/server

      Usage:
      both accept a single argument:
      i) Number:
      the error code number(https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/n1ql-error-codes.html) 

      • outputs: error message for that error code 

      tool:

      ./finderr 5011          
       
       
      CODE
          5011 (error)
       
       
      DESCRIPTION
          Abort: «reason»
       
       
      REASON
          The SQL++ abort() function was called in the statement.
          e.g. SELECT abort('An example cause')
       
       
      USER ERROR
          Yes
       
       
      APPLIES TO
          Server 

      function:

       

      cbq> SELECT finderr(5011);
      {
          "requestID": "cc25333e-31a2-4695-876e-fb8ea6451a04",
          "signature": {
              "$1": "object"
          },
          "results": [
          {
              "$1": [
                  {
                      "applies_to": "Server",
                      "code": 5011,
                      "description": "Abort: «reason»",
                      "reason": [
                          [
                              "The SQL++ abort() function was called in the statement.",
                              "e.g. SELECT abort('An example cause')"
                          ]
                      ],
                      "user_error": "Yes"
                  }
              ]
          }
          ] 

      ii) String:
      search for match in code(as a string)/ symbol/ description/ any of the reasons/ any of the actions/ applies-to 

      tool:

      // a single match-> displays the entire message
      ./finderr "A semantic error is present in the statement."
       
       
      CODE
          3100 (error)
       
       
      DESCRIPTION
          A semantic error is present in the statement.
       
       
      REASON
          The statement includes portions that violate semantic constraints.
       
       
      USER ACTION
          The cause will contain more detail on the violation; revise the statement and re-submit.
       
       
      USER ERROR
          Yes
       
       
      APPLIES TO
          Server

      // multiple matches: displays only the code and description( search for all semantic related errors)
       ./finderr "semantic"
       
       
      Matching errors
        3100 A semantic error is present in the statement.
        3220 «name» window function «clause» «reason»
        3300 recursive_with semantics: «cause»

      function:

      // always displays entire message:
       
      cbq> SELECT finderr("A semantic error is present in the statement.");
      {
          "requestID": "5d8c305d-4628-4bab-a81c-c23f51fdc237",
          "signature": {
              "$1": "object"
          },
          "results": [
          {
              "$1": [
                  {
                      "applies_to": "Server",
                      "code": 3100,
                      "description": "A semantic error is present in the statement.",
                      "reason": [
                          "The statement includes portions that violate semantic constraints."
                      ],
                      "user_action": [
                          "The cause will contain more detail on the violation; revise the statement and re-submit."
                      ],
                      "user_error": "Yes"
                  }
              ]
          }
          ]
       
      cbq> SELECT finderr("semantic");
      {
          "requestID": "c3c95af8-7f26-4582-acf4-5164e7bacce4",
          "signature": {
              "$1": "object"
          },
          "results": [
          {
              "$1": [
                  {
                      "applies_to": "Server",
                      "code": 3100,
                      "description": "A semantic error is present in the statement.",
                      "reason": [
                          "The statement includes portions that violate semantic constraints."
                      ],
                      "user_action": [
                          "The cause will contain more detail on the violation; revise the statement and re-submit."
                      ],
                      "user_error": "Yes"
                  },
                  {
                      "applies_to": "Server",
                      "code": 3220,
                      "description": "«name» window function «clause» «reason»",
                      "reason": [
                          "A violation of the window function semantic restrictions was present in the statement."
                      ],
                      "user_action": [
                          "Revise the statement to remove the violation."
                      ],
                      "user_error": "Yes"
                  },
                  {
                      "applies_to": "Server",
                      "code": 3300,
                      "description": "recursive_with semantics: «cause»",
                      "reason": [
                          "The statement specifies restricted syntax in a recursive common table expression definition."
                      ],
                      "user_action": [
                          "Revise the statement removing the restricted syntax."
                      ],
                      "user_error": "Yes"
                  }
              ]
          }
          ]

       

      iii) regex:
      similar to string input but now matches the pattern.

      tool:

      // search for upsert , insert related errors
      ./finderr "[UI][NP]SERT"
       
       
      Matching errors
        3150 MERGE with ON KEY clause cannot have document key specification in INSERT action.
        3160 MERGE with ON clause must have document key specification in INSERT action
        3180 MERGE with ON KEY clause cannot have USE INDEX hint specified on target.
        5006 Out of key validation space.
        5050 No INSERT key for «document»
        5060 No INSERT value for «document»
        5070 Cannot INSERT non-string key «key» of type «type»
        5071 Cannot INSERT non-OBJECT options «options» of type «type»
        5072 No UPSERT key for «value»
        5073 Cannot act on the same key multiple times in an UPSERT statement
        5075 No UPSERT value for «value»
        5078 Cannot UPSERT non-string key «key» of type «type».
        5079 Cannot UPSERT non-OBJECT options «value» of type «type».
        5330 Multiple INSERT of the same document (document key «key») in a MERGE statement
       12036 Error in INSERT of key: «key»
       15005 No keys to insert «details» 

      function:

      cbq> SELECT finderr("[IU][NP]SERT");
      {
          "requestID": "de040357-c726-46bc-892d-bb64a51f28e8",
          "signature": {
              "$1": "object"
          },
          "results": [
          {
              "$1": [
                  {
                      "applies_to": "Server",
                      "code": 3150,
                      "description": "MERGE with ON KEY clause cannot have document key specification in INSERT action.",
                      "reason": [
                          [
                              "A lookup merge statement specified a document key.",
                              "e.g. MERGE INTO default USING [{},{}] AS source ON KEY 'aaa' WHEN NOT MATCHED THEN INSERT ('key',{})"
                          ]
                      ],
                      "user_action": [
                          "Refer to the documentation for lookup merge statements."
                      ],
                      "user_error": "Yes"
                  },
                  {
                      "applies_to": "Server",
                      "code": 3160,
                      "description": "MERGE with ON clause must have document key specification in INSERT action",
                      "reason": [
                          [
                              "An ANSI merge statement did not include the document key specification.",
                              "e.g. MERGE INTO default USING [{},{}] AS source ON default.id IS VALUED WHEN NOT MATCHED THEN INSERT ({})"
                          ]
                      ],
                      "user_action": [
                          "Refer to the documentation for ANSI merge statements."
                      ],
                      "user_error": "Yes"
                  },
                  {
                      "applies_to": "Server",
                      "code": 3180,
                      "description": "MERGE with ON KEY clause cannot have USE INDEX hint specified on target.",
                      "reason": [
                          [
                              "The USE INDEX hint is not supported with lookup merge statement targets.",
                              "e.g. MERGE INTO default USE INDEX (ix) USING [{},{}] AS source ON KEY 'aaa' WHEN NOT MATCHED THEN INSERT ({})"
                          ]
                      ],
                      "user_action": [
                          "Refer to the documentation for lookup merge statements."
                      ],
                      "user_error": "Yes"
                  },
                  {
                      "applies_to": "Server",
                      "code": 5006,
                      "description": "Out of key validation space.",
                      "reason": [
                          "The INSERT operation was using a sequential scan exhausted the space reserved to exclude new keys.",
                          "The space reserved to record keys processed by the UPSERT statement was exhausted."
                      ],
                      "user_action": [
                          "Divide the statement into portions that don't exceed the key validation space.",
                          "Create a suitable secondary index to support the statement."
                      ],
                      "user_error": "Yes"
                  },
                  {
                      "applies_to": "Server",
                      "code": 5050,
                      "description": "No INSERT key for «document»",
                      "user_action": [
                          "Contact support."
                      ]
                  },
                  {
                      "applies_to": "Server",
                      "code": 5060,
                      "description": "No INSERT value for «document»",
                      "user_action": [
                          "Contact support."
                      ]
                  },
                  {
                      "applies_to": "Server",
                      "code": 5070,
                      "description": "Cannot INSERT non-string key «key» of type «type»",
                      "reason": [
                          [
                              "The statement includes an INSERT operation with a non-string key value.",
                              "e.g. INSERT INTO default VALUES(1,{'the':'value'})"
                          ]
                      ],
                      "user_action": [
                          "Revise the statement to ensure keys are always string values."
                      ],
                      "user_error": "Yes"
                  },
                  {
                      "applies_to": "Server",
                      "code": 5071,
                      "description": "Cannot INSERT non-OBJECT options «options» of type «type»",
                      "reason": [
                          [
                              "The statement includes an INSERT operation with a non-OBJECT options value.",
                              "e.g. INSERT INTO default VALUES('the_key',{'the':'value'},null)"
                          ]
                      ],
                      "user_action": [
                          "Revise the statement to ensure insert options are always provided as an object value or omitted if unneeded."
                      ],
                      "user_error": "Yes"
                  },
                  {
                      "applies_to": "Server",
                      "code": 5072,
                      "description": "No UPSERT key for «value»",
                      "user_action": [
                          "Contact support."
                      ]
                  },
                  {
                      "applies_to": "Server",
                      "code": 5073,
                      "description": "Cannot act on the same key multiple times in an UPSERT statement",
                      "reason": [
                          [
                              "The UPSERT statement was trying to modify the same key multiple times.",
                              "e.g. UPSERT INTO default VALUES ('key0',{}),('key0',{})"
                          ]
                      ],
                      "user_action": [
                          "Revise the statement to ensure that keys are unique."
                      ],
                      "user_error": "Yes"
                  },
                  {
                      "applies_to": "Server",
                      "code": 5075,
                      "description": "No UPSERT value for «value»",
                      "user_action": [
                          "Contact support."
                      ]
                  },
                  {
                      "applies_to": "Server",
                      "code": 5078,
                      "description": "Cannot UPSERT non-string key «key» of type «type».",
                      "reason": [
                          [
                              "The statement includes an UPSERT operation with a non-string key value.",
                              "e.g. UPSERT INTO default VALUES(1,{'the':'value'})"
                          ]
                      ],
                      "user_action": [
                          "Revise the statement to ensure keys are always string values."
                      ],
                      "user_error": "Yes"
                  },
                  {
                      "applies_to": "Server",
                      "code": 5079,
                      "description": "Cannot UPSERT non-OBJECT options «value» of type «type»."
                  },
                  {
                      "applies_to": "Server",
                      "code": 5330,
                      "description": "Multiple INSERT of the same document (document key «key») in a MERGE statement",
                      "reason": [
                          [
                              "The INSERT action of the MERGE statement had previously inserted the noted key.",
                              "e.g. MERGE INTO default",
                              "     USING [{},{}] AS source",
                              "     ON default.id IS VALUED",
                              "     WHEN NOT MATCHED THEN",
                              "     INSERT ('key',{})",
                              "     ;"
                          ]
                      ],
                      "user_action": [
                          "Revise the statement logic to ensure only unique keys are produced."
                      ],
                      "user_error": "Yes"
                  },
                  {
                      "applies_to": "Server",
                      "code": 12036,
                      "description": "Error in INSERT of key: «key»",
                      "reason": [
                          "A data service error occurred whilst adding a document."
                      ],
                      "user_action": [
                          "Review the error for possible user actions.",
                          "Retry the request if appropriate.",
                          "Contact support."
                      ]
                  },
                  {
                      "applies_to": "Server",
                      "code": 15005,
                      "description": "No keys to insert «details»"
                  }
              ]
          }
          ] 

       

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              simon.dew Simon Dew
              gaurav.jayaraj Gaurav Jayaraj
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty