Skip to content

databricks metastores current and other commands are SIGSEGV when using incorrect profile #913

@alexott

Description

@alexott

Databricks CLI v0.208.2

If I select an incorrect configuration profile, like, account level inside of workspace level, CLI crashes

# databricks metastores current
Using workspace profile: az-account
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0xf0 pc=0x1050e537c]

goroutine 1 [running]:
github.com/databricks/cli/cmd/workspace/metastores.newCurrent.func1(0x14000416c00?, {0x105da1180?, 0x0?, 0x0?})
	github.com/databricks/cli/cmd/workspace/metastores/metastores.go:217 +0x5c
github.com/spf13/cobra.(*Command).execute(0x14000416c00, {0x105da1180, 0x0, 0x0})
	github.com/spf13/[email protected]/command.go:940 +0x658
github.com/spf13/cobra.(*Command).ExecuteC(0x1400039e000)
	github.com/spf13/[email protected]/command.go:1068 +0x320
github.com/spf13/cobra.(*Command).ExecuteContextC(...)
	github.com/spf13/[email protected]/command.go:1001
github.com/databricks/cli/cmd/root.Execute(0x105619960?)
	github.com/databricks/cli/cmd/root/root.go:99 +0x58
main.main()
	github.com/databricks/cli/main.go:11 +0x30

Or

# databricks system-schemas list $(databricks metastores current |jq -r .metastore_id)
Using workspace profile: az-alexott
Using workspace profile: az-account
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x1a0 pc=0x104e8835c]

goroutine 1 [running]:
github.com/databricks/cli/cmd/workspace/system-schemas.newList.func2(0x14000458300?, {0x140004374a0, 0x1, 0x1?})
	github.com/databricks/cli/cmd/workspace/system-schemas/system-schemas.go:208 +0xac
github.com/spf13/cobra.(*Command).execute(0x14000458300, {0x14000437470, 0x1, 0x1})
	github.com/spf13/[email protected]/command.go:940 +0x658
github.com/spf13/cobra.(*Command).ExecuteC(0x14000394000)
	github.com/spf13/[email protected]/command.go:1068 +0x320
github.com/spf13/cobra.(*Command).ExecuteContextC(...)
	github.com/spf13/[email protected]/command.go:1001
github.com/databricks/cli/cmd/root.Execute(0x105375960?)
	github.com/databricks/cli/cmd/root/root.go:99 +0x58
main.main()
	github.com/databricks/cli/main.go:11 +0x30

We need to handle such cases gracefully & show a human-readable error to the users.

Metadata

Metadata

Assignees

Labels

BugSomething isn't workingCLICLI related issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions