nebula-go报错: Authentication fails, Invalid data length

执行到client.Connect()函数时报错:Authentication fails, Invalid data length

package main

import (

  nebula ""

func main() {
  client, err := nebula.NewClient("")
  if err != nil {

  if err = client.Connect("", ""); err != nil {
  defer client.Disconnect()

  resp, err := client.Execute("SHOW HOSTS;")
  if err != nil {

  if nebula.IsError(resp) {
    log.Printf("ErrorCode: %v, ErrorMsg: %s", resp.GetErrorCode(), resp.GetErrorMsg())


########## authorization ##########
# Enable authorization

########## Authentication ##########
# User login authentication type, password for nebula authentication, ldap for ldap authentication, cloud for cloud authentication


很奇怪的是,我跑nebula-go项目中的client_test.go是可以的。但是在上面的代码里,用同样的ip, port, username, password,会报"Authentication fails, Invalid data length"

First of all my apologies for writing in English, I am afraid that Google translate to Chinese may garble what I am about to say. I have similar error to what Arthritis encountered. I have Nebula installed and working (1.0) under docker-compose, can access it via command-line client and Nebula studio. However when I try to connect via Go client (same code as above) I have same error.

I went to nebula-docker-compose_graphd_1 and edited the nebula-graphd.conf (switched --enable_authorise to false and true) - this had an effect on command-line client. When --enable_authorize=true it refused to connect with default username/password

when set to false command line client connected without username/password no problem at all.
However this has no effect at all on Go client. The error remains. Could you kindly direct me, what am I doing wrong? yet again, sorry for writing in foreign language. Any help is much appreciated.


Hi, I have found out why “Invalid data length” problem happens.

It’s because the fbthrift version on your client is not compatible with nebula.

You can check the “go.mod” file in nebula-go project, it need “require v0.0.0-20190922225929-2f9839604e25”

And for the second problem about failed to authenticate “user”, try “-u root -p nebula” instead of “-u user -p password”


when enable_authorize is false,
There is no difference between a and b “-u root -p nebula” and “-u user -p password

hi, arthritis and all

many thanks for your help. I have checked go.mod and the version was right. I have created another user with admin privileges on nba. Explicitly enabled the password authentication in nebula-graphd.conf. I ran the code in the debugger and nailed it, where the error appears.

Tomorrow I will set up a breakpoint there and will step in to find out exactly where it appears.
Thanks a million for your help.


Dear yee, you are spot on. So, what I did now to correct this error above.

  1. create the empty folder outside GOPATH
  2. generated mod file, as per your link
  3. first tried with command-line (build/run) it worked - no fatal errors
  4. then created the new GoLand (it is SDK on the pic above in this thread) project in the same folder I have just created
  5. SDK imported go.mod
  6. run - success, not annoying error

Dear all, thanks a million for your help - looks like I came over this hurdle. Sure there will be more, but at least I know where to ask.


ah, if you need, we have an international forum:, which has more English details and a better site visit speed for other places out of China. :wink: