Skip to content

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

@PeteyPii

Description

@PeteyPii

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/<project_id>/instances/<instance_id>'.
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/<project_id>/instances/<instance_id>'. [google.rpc.error_details_ext] { message: "When parsing \'projects/autonomous-mote-782/instances/abc_123\' : Instance name expected in the form \'projects/<project_id>/instances/<instance_id>\'." } stack =

"Instance name expected in the form 'projects/<project_id>/instances/<instance_id>'" 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions