Newrelic cli "--format text" panics (panic: reflect: NumField of non-struct type nrdb.NrdbResult)

 [~/git/nrql] $ newrelic nrql query --format text --accountId 183405 --query "FROM ElasticMapReduceClusterSample select entityName , providerAccountName , label.Project "
panic: reflect: NumField of non-struct type nrdb.NrdbResult

goroutine 1 [running]:
reflect.(*rtype).NumField(0x15e91e0, 0x1749360)
/usr/local/Cellar/go/1.15/libexec/src/reflect/type.go:974 +0xb7
[github.com/newrelic/newrelic-cli/internal/output.(*Output).renderAsTable(0xc00000c360](http://github.com/newrelic/newrelic-cli/internal/output.(*Output).renderAsTable(0xc00000c360), 0x15a85c0, 0xc000245560, 0x0, 0x8)
/private/tmp/newrelic-cli-20200828-41669-1an9rog/newrelic-cli-0.13.0/internal/output/text.go:54 +0x175
[github.com/newrelic/newrelic-cli/internal/output.(*Output).text(0xc00000c360](http://github.com/newrelic/newrelic-cli/internal/output.(*Output).text(0xc00000c360), 0x15a85c0, 0xc000245560, 0x15c5980, 0xc0001b8f01)
/private/tmp/newrelic-cli-20200828-41669-1an9rog/newrelic-cli-0.13.0/internal/output/text.go:28 +0xcd
[github.com/newrelic/newrelic-cli/internal/output.Print(0x15a85c0](http://github.com/newrelic/newrelic-cli/internal/output.Print(0x15a85c0), 0xc000245560, 0xd, 0xc000245560)
/private/tmp/newrelic-cli-20200828-41669-1an9rog/newrelic-cli-0.13.0/internal/output/print.go:19 +0xdc
[github.com/newrelic/newrelic-cli/internal/nrql.glob..func1.1(0xc000200000)](http://github.com/newrelic/newrelic-cli/internal/nrql.glob..func1.1(0xc000200000))
/private/tmp/newrelic-cli-20200828-41669-1an9rog/newrelic-cli-0.13.0/internal/nrql/command_query.go:38 +0xff
[github.com/newrelic/newrelic-cli/internal/client.WithClientFrom.func1.1(0xc0001d9080)](http://github.com/newrelic/newrelic-cli/internal/client.WithClientFrom.func1.1(0xc0001d9080))
/private/tmp/newrelic-cli-20200828-41669-1an9rog/newrelic-cli-0.13.0/internal/client/helpers.go:25 +0xb8
[github.com/newrelic/newrelic-cli/internal/credentials.WithCredentialsFrom(0xc000025180](http://github.com/newrelic/newrelic-cli/internal/credentials.WithCredentialsFrom(0xc000025180), 0x1d, 0xc000173c78)
/private/tmp/newrelic-cli-20200828-41669-1an9rog/newrelic-cli-0.13.0/internal/credentials/helpers.go:21 +0xa9
[github.com/newrelic/newrelic-cli/internal/client.WithClientFrom.func1(0xc000078dc0)](http://github.com/newrelic/newrelic-cli/internal/client.WithClientFrom.func1(0xc000078dc0))
/private/tmp/newrelic-cli-20200828-41669-1an9rog/newrelic-cli-0.13.0/internal/client/helpers.go:19 +0x6d
[github.com/newrelic/newrelic-cli/internal/config.WithConfigFrom(0xc000025180](http://github.com/newrelic/newrelic-cli/internal/config.WithConfigFrom(0xc000025180), 0x1d, 0xc000173d08)
/private/tmp/newrelic-cli-20200828-41669-1an9rog/newrelic-cli-0.13.0/internal/config/helpers.go:19 +0xa9
[github.com/newrelic/newrelic-cli/internal/client.WithClientFrom(0xc000025180](http://github.com/newrelic/newrelic-cli/internal/client.WithClientFrom(0xc000025180), 0x1d, 0x16abf28)
/private/tmp/newrelic-cli-20200828-41669-1an9rog/newrelic-cli-0.13.0/internal/client/helpers.go:18 +0x6c
[github.com/newrelic/newrelic-cli/internal/client.WithClient(..](http://github.com/newrelic/newrelic-cli/internal/client.WithClient(..).)
/private/tmp/newrelic-cli-20200828-41669-1an9rog/newrelic-cli-0.13.0/internal/client/helpers.go:13
[github.com/newrelic/newrelic-cli/internal/nrql.glob..func1(0x1a600e0](http://github.com/newrelic/newrelic-cli/internal/nrql.glob..func1(0x1a600e0), 0xc000033bc0, 0x0, 0x6)
/private/tmp/newrelic-cli-20200828-41669-1an9rog/newrelic-cli-0.13.0/internal/nrql/command_query.go:31 +0x45
[github.com/spf13/cobra.(*Command).execute(0x1a600e0](http://github.com/spf13/cobra.(*Command).execute(0x1a600e0), 0xc000033b60, 0x6, 0x6, 0x1a600e0, 0xc000033b60)
/Users/brew/Library/Caches/Homebrew/go_mod_cache/pkg/mod/[github.com/spf13/](http://github.com/spf13/)[cobra@v1.0.0](mailto:cobra@v1.0.0)/command.go:846 +0x2c2
[github.com/spf13/cobra.(*Command).ExecuteC(0x1a62060](http://github.com/spf13/cobra.(*Command).ExecuteC(0x1a62060), 0x2, 0x0, 0x0)
/Users/brew/Library/Caches/Homebrew/go_mod_cache/pkg/mod/[github.com/spf13/](http://github.com/spf13/)[cobra@v1.0.0](mailto:cobra@v1.0.0)/command.go:950 +0x375
[github.com/spf13/cobra.(*Command).Execute(..](http://github.com/spf13/cobra.(*Command).Execute(..).)
/Users/brew/Library/Caches/Homebrew/go_mod_cache/pkg/mod/[github.com/spf13/](http://github.com/spf13/)[cobra@v1.0.0](mailto:cobra@v1.0.0)/command.go:887
main.Execute(0xc000173f78, 0x1005f85)
/private/tmp/newrelic-cli-20200828-41669-1an9rog/newrelic-cli-0.13.0/cmd/newrelic/command.go:35 +0xc5
main.main()
/private/tmp/newrelic-cli-20200828-41669-1an9rog/newrelic-cli-0.13.0/cmd/newrelic/main.go:47 +0x26
[~/git/nrql] $

If I remove the --format text, it works just fine.

Hi @atsalolikhin, thanks for reporting. This looks like a bug we’ll need to fix. We’re tracking it at the in this GitHub issue. We’ll take a look! Please feel free to file GitHub issues in the newrelic-cli repository for scenarios like this. :slight_smile:

1 Like

Okay. Will do. Thank you very much! :slight_smile:

Thanks @sblue for your help on this!

1 Like