Panic runtime error while running Hello Couchbase application

Installed go SDK 1.6 following the instructions given here:
https://docs.couchbase.com/go-sdk/current/start-using-sdk.html
Created Hello Couchbase application as listed on the above page. While running the application, the program panics at the line :slight_smile:
for rows.Next(&row) {
and produces the following error:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x12d66b2]
Go version prints the following: go version go1.12.9 darwin/amd64
macOS version 10.14.6
Any help will be appreciated.
Thanks!

Hi @Tushar_Kale thanks for raising this. What’s probably happening here is that ExecuteN1qlQuery is returning an error so rows is nil. In the sample we have ignored error handling to make it more readable. If you change rows, _ := bucket.ExecuteN1qlQuery(query, []interface{}{"African Swallows"}) to rows, err := bucket.ExecuteN1qlQuery(query, []interface{}{"African Swallows"}) and check for (and handle) an err value that will probably fix it.

I’ll raise an issue to include error handling in the samples :slight_smile:

@chvck Hi ,
we hit the same issue with Panic Error and its very intermittent . We are on CB 6.5 Enterprise edition and thinking of to build application in Production but this gives us some less hope … what could be the error reason and its random …sometime it works for 2 people and sometime other 2 people gets error for EXACT same query . we have 4 node cluster and our bucket is 400K records only and cluster size is huge … any ideas ?

<N1QL Execution failed, OBJ={‘code’: 5001, ‘msg’: ‘Panic: runtime error: invalid memory address or nil pointer dereference’}>

Also adding @vsr1 @keshav_m @geraldss if they ever saw this for N1QL query .

If you are seeing error in Query workbench please post the query and EXPLAIN, Index definition.
If it is panic check query.log of the query service you should have function stack in the log post that as well.
If you have service level agreement you can contact Technical support as well.
Try with 6.5.1