googleapis / googleapis/cloud-bigtable-cbt-cli

`cbt ls` error message is obtuse when using a bad instance ID

Open
#143 0 comments 0 reactions 0 assignees View on GitHub
priority: p2 type: bug
Dominant language
Go
Stars
15
Forks
42
PR merge metrics
No merged PRs in 30d

Description

If I run `cbt -instance=abc_123 ls` I get an error message which does not help me diagnose my problem. I get:

```
$ cbt -instance=abc_123 ls
2023/05/02 15:18:54 -creds flag unset, will use gcloud credential
2023/05/02 15:18:54 -project flag unset, will use gcloud active project
2023/05/02 15:18:54 gcloud active project is "autonomous-mote-782"
2023/05/02 15:18:54 Getting list of tables: rpc error: code = InvalidArgument desc = When parsing 'projects/autonomous-mote-782/instances/abc_123' : Instance name expected in the form 'projects//instances/'.
error details: name = DebugInfo detail = [ORIGINAL ERROR] generic::invalid_argument: When parsing 'projects/autonomous-mote-782/instances/abc_123' : Instance name expected in the form 'projects//instances/'. [google.rpc.error_details_ext] { message: "When parsing \'projects/autonomous-mote-782/instances/abc_123\' : Instance name expected in the form \'projects//instances/\'." } stack =
```

"Instance name expected in the form \'projects//instances/\'" is very confusing since my instance name seemingly does match this pattern.

Conversely, if I do `cbt -instance=abc ls`, I get a better error message explaining what is wrong:

```
$ cbt -instance=abc ls
2023/05/02 15:18:46 -creds flag unset, will use gcloud credential
2023/05/02 15:18:46 -project flag unset, will use gcloud active project
2023/05/02 15:18:47 gcloud active project is "autonomous-mote-782"
2023/05/02 15:18:47 Getting list of tables: rpc error: code = InvalidArgument desc = When parsing 'projects/autonomous-mote-782/instances/abc' : Invalid id for collection instances : Length should be between [6,33], but found 3 'abc'
error details: name = DebugInfo detail = [ORIGINAL ERROR] generic::invalid_argument: When parsing 'projects/autonomous-mote-782/instances/abc' : Invalid id for collection instances : Length should be between [6,33], but found 3 'abc' [google.rpc.error_details_ext] { message: "When parsing \'projects/autonomous-mote-782/instances/abc\' : Invalid id for collection instances : Length should be between [6,33], but found 3 \'abc\'" } stack =
```

It would be nice if the CLI told me why the instance name was unparseable or at least show me the regex which my instance ID needs to match.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.