Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unmarshalling error on withdraw-all-rewards #3900

Closed
4 tasks
okwme opened this issue Mar 14, 2019 · 10 comments
Closed
4 tasks

unmarshalling error on withdraw-all-rewards #3900

okwme opened this issue Mar 14, 2019 · 10 comments

Comments

@okwme
Copy link
Contributor

okwme commented Mar 14, 2019

Summary of Bug

trying to run command gaiacli tx distr withdraw-all-rewards --from $MY_ADDR but getting this error:

ERROR: ABCIQuery: Error unmarshalling rpc response: invalid character '<' looking for beginning of value

Same thing happens when I run it without the --from flag.

Steps to Reproduce

Be me, delegate, try to withdraw-all-rewards. When run with --trace i get this:

ERROR: Error unmarshalling rpc response: invalid character '<' looking for beginning of value
github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/rpc/lib/client.unmarshalResponseBytes
	/Users/billy/go/src/github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/rpc/lib/client/http_client.go:190
github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/rpc/lib/client.(*JSONRPCClient).Call
	/Users/billy/go/src/github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/rpc/lib/client/http_client.go:124
github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/rpc/client.(*HTTP).ABCIQueryWithOptions
	/Users/billy/go/src/github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/rpc/client/httpclient.go:77
github.com/cosmos/cosmos-sdk/client/context.CLIContext.query
	/Users/billy/go/src/github.com/cosmos/cosmos-sdk/client/context/query.go:160
github.com/cosmos/cosmos-sdk/client/context.CLIContext.QueryWithData
	/Users/billy/go/src/github.com/cosmos/cosmos-sdk/client/context/query.go:41
github.com/cosmos/cosmos-sdk/x/distribution/client/common.QueryDelegatorValidators
	/Users/billy/go/src/github.com/cosmos/cosmos-sdk/x/distribution/client/common/common.go:82
github.com/cosmos/cosmos-sdk/x/distribution/client/common.WithdrawAllDelegatorRewards
	/Users/billy/go/src/github.com/cosmos/cosmos-sdk/x/distribution/client/common/common.go:105
github.com/cosmos/cosmos-sdk/x/distribution/client/cli.GetCmdWithdrawAllRewards.func1
	/Users/billy/go/src/github.com/cosmos/cosmos-sdk/x/distribution/client/cli/tx.go:96
github.com/cosmos/cosmos-sdk/vendor/github.com/spf13/cobra.(*Command).execute
	/Users/billy/go/src/github.com/cosmos/cosmos-sdk/vendor/github.com/spf13/cobra/command.go:762
github.com/cosmos/cosmos-sdk/vendor/github.com/spf13/cobra.(*Command).ExecuteC
	/Users/billy/go/src/github.com/cosmos/cosmos-sdk/vendor/github.com/spf13/cobra/command.go:852
github.com/cosmos/cosmos-sdk/vendor/github.com/spf13/cobra.(*Command).Execute
	/Users/billy/go/src/github.com/cosmos/cosmos-sdk/vendor/github.com/spf13/cobra/command.go:800
github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/libs/cli.Executor.Execute
	/Users/billy/go/src/github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/libs/cli/setup.go:89
main.main
	/Users/billy/go/src/github.com/cosmos/cosmos-sdk/cmd/gaia/cmd/gaiacli/main.go:103
runtime.main
	/usr/local/go/src/runtime/proc.go:200
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1337
ABCIQuery
github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/rpc/client.(*HTTP).ABCIQueryWithOptions
	/Users/billy/go/src/github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/rpc/client/httpclient.go:81
github.com/cosmos/cosmos-sdk/client/context.CLIContext.query
	/Users/billy/go/src/github.com/cosmos/cosmos-sdk/client/context/query.go:160
github.com/cosmos/cosmos-sdk/client/context.CLIContext.QueryWithData
	/Users/billy/go/src/github.com/cosmos/cosmos-sdk/client/context/query.go:41
github.com/cosmos/cosmos-sdk/x/distribution/client/common.QueryDelegatorValidators
	/Users/billy/go/src/github.com/cosmos/cosmos-sdk/x/distribution/client/common/common.go:82
github.com/cosmos/cosmos-sdk/x/distribution/client/common.WithdrawAllDelegatorRewards
	/Users/billy/go/src/github.com/cosmos/cosmos-sdk/x/distribution/client/common/common.go:105
github.com/cosmos/cosmos-sdk/x/distribution/client/cli.GetCmdWithdrawAllRewards.func1
	/Users/billy/go/src/github.com/cosmos/cosmos-sdk/x/distribution/client/cli/tx.go:96
github.com/cosmos/cosmos-sdk/vendor/github.com/spf13/cobra.(*Command).execute
	/Users/billy/go/src/github.com/cosmos/cosmos-sdk/vendor/github.com/spf13/cobra/command.go:762
github.com/cosmos/cosmos-sdk/vendor/github.com/spf13/cobra.(*Command).ExecuteC
	/Users/billy/go/src/github.com/cosmos/cosmos-sdk/vendor/github.com/spf13/cobra/command.go:852
github.com/cosmos/cosmos-sdk/vendor/github.com/spf13/cobra.(*Command).Execute
	/Users/billy/go/src/github.com/cosmos/cosmos-sdk/vendor/github.com/spf13/cobra/command.go:800
github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/libs/cli.Executor.Execute
	/Users/billy/go/src/github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/libs/cli/setup.go:89
main.main
	/Users/billy/go/src/github.com/cosmos/cosmos-sdk/cmd/gaia/cmd/gaiacli/main.go:103
runtime.main
	/usr/local/go/src/runtime/proc.go:200
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1337

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@okwme
Copy link
Contributor Author

okwme commented Mar 14, 2019

Ah I understand now the node I was connecting to is down and returning a 400 error. The < must be the html. Maybe we can detect file type from the header response and warn that we're getting an invalid response type instead of just throwing on whatever ends up coming through?

@alexanderbez
Copy link
Contributor

HTML? Where is the HTML coming from? It should only be JSON that is returned from the queriers.

@okwme
Copy link
Contributor Author

okwme commented Mar 15, 2019

because the host i was using is down it returns a 400 error in the form of an html website to display the 400 error

@alexanderbez
Copy link
Contributor

@okwme I don't quite understand the problem here.

@okwme
Copy link
Contributor Author

okwme commented Mar 16, 2019

so i was using a bad endpoint as my node. because it was a bad endpoint, the requests it received were responded to with html instead of json. this is obv my fault, but the point i meant was that there is no error handling on the SDK for when the document received is not a json doc.

i'm suggesting a new error handler, that checked the doc type from the response header and threw an error that said something like, "wrong doc type received" instead of trying to parse the html as json (which produces the error i pasted above).

@jackzampolin
Copy link
Member

As you mentioned we just need to return a proper error for the bad connection

@alexanderbez
Copy link
Contributor

Yeah looks like we're not returning an error gracefully when parsing the response. I don't think we should be checking for headers and content-type.

@yangyanqing
Copy link
Contributor

Ah I understand now the node I was connecting to is down and returning a 400 error.

I got ERROR: ABCIQuery: Post http://localhost:26657: dial tcp [::1]:26657: connect: connection refused when node was down.

so i was using a bad endpoint as my node. because it was a bad endpoint,

Did you mean the point you connected was NOT cosmos node ?

@okwme

@okwme
Copy link
Contributor Author

okwme commented Apr 15, 2019

correct @yangyanqing I was connecting to a cosmos node that was offline. The response was not in the expected format but the SDK did not handle this un-expected response with a very descriptive error. I was suggesting maybe to make a new error that checks the response for correct format?

@tac0turtle
Copy link
Member

closing this issue as error handling has changed quite a bit since this was opened. If the error still persists please open a new issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants