diff --git a/x/compute/client/cli/tx.go b/x/compute/client/cli/tx.go index 606cc6c07..96238e342 100644 --- a/x/compute/client/cli/tx.go +++ b/x/compute/client/cli/tx.go @@ -384,6 +384,11 @@ func GetCodeHashByCodeId(cliCtx client.Context, codeID string) ([]byte, error) { return nil, err } + // When querying for an unknown code id the output is an empty result (without any error) + if len(res) == 0 { + return nil, fmt.Errorf("failed to query contract code hash, unknown code id (%s)", codeID) + } + var codeResp types.QueryCodeResponse err = json.Unmarshal(res, &codeResp)