Query UI Monitor bug?

Enterprise 6.5

I am running a query in the monitor and getting results. But when running explain or clicking for the plan or plan text I’m getting the following error:

Internal error generating query plan: TypeError: Cannot read property 'properties' of undefined

This sounds Iike JS issue. And since the query is returning results, I have to assume the engine is in fact able to generate a plan.

All other queries that I’ve ever tried and that I’m trying now work fine.

I really wish I knew how to better help you, I’ve located the piece in my query that brings about this failure, but I cannot reproduce it, abstracting it into a general form that will be helpful for you.

I am hoping that you’ve seen this error message before and can give me some guidance as to how I can help you help me :slight_smile:

Try with different browser . cc @eben


I get the error on Chrome: Version 73.0.3683.103 (Official Build) (64-bit)

But do not on Firefox 77.0.1

I’m on a Ubuntu system.

Thanks @naftali. I will reproduce and log a bug or you are welcome to log it yourself here https://issues.couchbase.com/

Hi @naftali, that error can occur when a query explain is being analyzed. Is there a more detailed error in your browser’s javascript console?

Also, could you post the ‘EXPLAIN’ plan for your query, so I could run it through the analyzer and see if I can reproduce the error?

The console error is no more informative than what I posted: “Exception analyzing query plan: TypeError: Cannot read property ‘properties’ of undefined”

I’d have to get an okay from security to share the explain, since it’s a production query. I can make the request but would first need a non public way to get it to you.

it’s failing in this code block:

            catch (exception) {
              console.log("Exception analyzing query plan: " + exception);
              newResult.explainResult = "Internal error generating query plan: " + exception;
              newResult.explainResultText = "Internal error generating query plan: " + exception;
              newResult.status = "explain error";

Hi @naftali, I’m a bit stumped, since the ‘try’ block associated with that ‘catch’ doesn’t contain any references to a field called ‘properties’. Since your explain plan is potentially sensitive, is there any chance you use the browser’s debugger to step through the ‘try’ block and tell me on which line the error is originating?

heh, @eben

Because I gain a lot from these forums and wanted to take the opportunity to give back, I thought I’d give it a go.

So I fired up the query monitor today located the explain error queries, but the error no longer reproduces for this query.

What I can say is that the query plan had to have changed pretty drastically, because I had added an index yesterday. Whereas before there was no covering index now there is.

Should I come across this again, I’ll be sure to debug that code block

Thank you @naftali. I’m glad you aren’t seeing the problem, and I appreciate whatever details you will provide if the problem reoccurs.

I’m getting this same error running a FTS geospatial N1QL query explain in the admin UI. The query returns results. This is with Couchbase Server 7.0.2 build 6703.

In Chrome 95.0.4638.69:

Internal error generating query plan: TypeError: Cannot read properties of undefined (reading ‘forEach’)

If I run the same in Firefox 94.0.1 this is the error:

Internal error generating query plan: TypeError: result.all_paths_used is undefined

And Safari 15.0 similarly:

Internal error generating query plan: TypeError: undefined is not an object (evaluating ‘result.all_paths_used.forEach’)

I can reproduce it with this query on the travel-sample bucket (with or without a FTS index):

FROM `travel-sample`.`inventory`.`landmark` AS l
  "query": {
    "top_left": {
      "lon": -1.680420,
      "lat": 53.509470
    "bottom_right": {
      "lon": -1.234866,
      "lat": 53.272751
    "field": "geo"

The JavaScript console output is:

Got error: [@25,126:133=‘1.680420’,<3>,6:14],6,14,no viable alternative at input ‘SELECT*FROMtravel-sample.inventory.landmarkASlWHERESEARCH(l,{“query”:{“top_left”:{“lon”:-1.680420’,

no viable alternative at input ‘SELECT*FROMtravel-sample.inventory.landmarkASlWHERESEARCH(l,{“query”:{“top_left”:{“lon”:-1.680420’

FROM^^^travel-sample.inventory.landmark AS l
“query”: {
“top_left”: {
“lon”: -1.680420,
“lat”: 53.509470
“bottom_right”: {
“lon”: -1.234866,
“lat”: 53.272751
“field”: “geo”

Got error: [@19,67:74=‘1.234866’,<3>,1:67],1,67,extraneous input ‘1.234866’ expecting ‘)’,null

extraneous input ‘1.234866’ expecting ‘)’

search(l, {“query”: {“bottom_right”: {“lat”: 53.272751, “lon”: (-^^^.234866)}, “field”: “geo”, “top_left”: {“lat”: 53.50947, “lon”: (-1.68042)}}})

Exception analyzing query plan: TypeError: Cannot read properties of undefined (reading ‘forEach’)

It seems to be getting hung up on parsing the lat/lon in the search JSON.

Hi @jeff.lockhart , this problem seems to be [MB-49274] UI can't analyze query plans for queries with certain functions - Couchbase database, where the client-side parser used to help analyze queries was failing with negative numbers. If you remove the minus signs in the longitude values of your query, the query plan will be shown. The fix is already in 7.1.


Oh, great, thank you!