diff --git a/NEXT_CHANGELOG.md b/NEXT_CHANGELOG.md index 99a11d8ae84..47e5b5fc58e 100644 --- a/NEXT_CHANGELOG.md +++ b/NEXT_CHANGELOG.md @@ -10,6 +10,7 @@ ### Bundles * Validate that resource keys do not contain variable references ([#5169](https://github.com/databricks/cli/pull/5169)) * engine/direct: Drop the deployment state entry on a recreate before the follow-up `Create`, so a `Create` failure no longer leaves a broken state with `invalid state: empty id` on the next `bundle plan` ([#5173](https://github.com/databricks/cli/pull/5173)). +* `bundle debug list-targets`: skip nil entries in the targets map instead of panicking when a target is declared with a null value ([#5203](https://github.com/databricks/cli/pull/5203)). ### Dependency updates diff --git a/cmd/bundle/debug/list_targets.go b/cmd/bundle/debug/list_targets.go index 02081a93710..6349ba46725 100644 --- a/cmd/bundle/debug/list_targets.go +++ b/cmd/bundle/debug/list_targets.go @@ -35,6 +35,12 @@ func collectTargets(targets map[string]*config.Target) []targetInfo { result := make([]targetInfo, 0, len(names)) for _, name := range names { t := targets[name] + // YAML decoding can leave a nil entry in the map when a target is + // declared with a null value. Skip rather than dereference and panic. + if t == nil { + result = append(result, targetInfo{Name: name}) + continue + } info := targetInfo{ Name: name, Default: t.Default,