From 99fd12b44d44c16aaaa5ae7ca6e9863189623ea9 Mon Sep 17 00:00:00 2001 From: Pavlo Kozlov Date: Thu, 7 May 2026 11:35:43 +0200 Subject: [PATCH 1/2] fix: guard against nil target entries in bundle debug list-targets YAML decoding can leave a nil *config.Target in the targets map when a target is declared with a null value, causing collectTargets to panic on field access. Skip nil entries while still listing the target name. --- cmd/bundle/debug/list_targets.go | 6 ++++++ 1 file changed, 6 insertions(+) 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, From d8f0ffe89aec77d6f524c325c342a5645e5e8380 Mon Sep 17 00:00:00 2001 From: Pavlo Kozlov Date: Thu, 7 May 2026 11:44:52 +0200 Subject: [PATCH 2/2] Add changelog entry for bundle debug list-targets nil guard --- NEXT_CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) 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