Skip to content

Null ptr de-reference if artifacts missing field #3017

@mattyding

Description

@mattyding

Describe the issue

Get the following stacktrace when running databricks bundle deploy. The issue is that in my databricks.yml, I have a template under artifacts with missing fields.

artifacts:
# in my real file, there are instructions here about what to comment/uncomment.
# E.g., uncomment build first_option if you want to test against prod wheel, uncomment build second_option to test against local build
  
  first_target:
    # build: <first_option_command>
    # path: <path>
    # build: <second_option_command>
    
  second_target
    # build: <first_option_command>
    # path: <path>
    # build: <second_option_command>

Stacktrace

The Databricks CLI unexpectedly had a fatal error.
Please report this issue to Databricks in the form of a GitHub issue at:
https://github.com/databricks/cli

CLI Version: 0.254.0

Panic Payload: runtime error: invalid memory address or nil pointer dereference

Stack Trace:
goroutine 1 [running]:
runtime/debug.Stack()
	runtime/debug/stack.go:26 +0x5e
github.com/databricks/cli/cmd/root.Execute.func1()
	github.com/databricks/cli/cmd/root/root.go:112 +0xb4
panic({0x136c9a0?, 0x2381800?})
	runtime/panic.go:792 +0x132
github.com/databricks/cli/bundle/artifacts.(*prepare).Apply(0xc0004a05d8?, {0x189ff80, 0xc0003f72c0}, 0xc0004a0588)
	github.com/databricks/cli/bundle/artifacts/prepare.go:38 +0x313
github.com/databricks/cli/bundle.Apply({0x189ff80, 0xc0003d0e70}, 0xc0004a0588, {0x1898340, 0x23d57e0})
	github.com/databricks/cli/bundle/mutator.go:38 +0x1e2
github.com/databricks/cli/bundle.ApplySeq({0x189ff80, 0xc0003d0e70}, 0xc0004a0588, {0xc0003a7500?, 0xc0005a2dc0?, 0x2?})
	github.com/databricks/cli/bundle/mutator.go:54 +0xb7
github.com/databricks/cli/bundle/phases.Initialize({0x189ff80, 0xc0003d0e70}, 0xc0004a0588)
	github.com/databricks/cli/bundle/phases/initialize.go:30 +0x851
github.com/databricks/cli/cmd/bundle.newDeployCommand.func1(0xc0003ad508, {0xc0003aad40?, 0x4?, 0x16333ca?})
	github.com/databricks/cli/cmd/bundle/deploy.go:73 +0x278
github.com/spf13/cobra.(*Command).execute(0xc0003ad508, {0xc0003aad00, 0x4, 0x4})
	github.com/spf13/cobra@v1.9.1/command.go:1015 +0xa94
github.com/spf13/cobra.(*Command).ExecuteC(0xc0001a8908)
	github.com/spf13/cobra@v1.9.1/command.go:1148 +0x40c
github.com/spf13/cobra.(*Command).ExecuteContextC(...)
	github.com/spf13/cobra@v1.9.1/command.go:1080
github.com/databricks/cli/cmd/root.Execute({0x189ff48, 0x23d57e0}, 0xc0001a8908)
	github.com/databricks/cli/cmd/root/root.go:141 +0x171
main.main()
	github.com/databricks/cli/main.go:13 +0x3b

Steps to reproduce the behavior

Create a YAML file with artifacts but nothing under artifacts, see example above.

Expected Behavior

Should not have a null ptr error + should throw nice error about missing artifacts.

Actual Behavior

Null ptr error

OS and CLI version

Please include the version of the CLI (eg: v0.1.2) and the operating system (eg: windows). You can run databricks --version to get the version of your Databricks CLI

Is this a regression?

Did this work in a previous version of the CLI? If so, which versions did you try?

Debug Logs

Output logs if you run the command with debug logs enabled. Example: databricks clusters list --log-level=debug. Redact if needed

Metadata

Metadata

Assignees

Labels

BugSomething isn't workingDABsDABs related issues

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions