From 430aa47444acef39c0691016401d80b7fc5f710c Mon Sep 17 00:00:00 2001 From: Or Toren Date: Sun, 14 Jun 2026 10:33:25 +0300 Subject: [PATCH] Handle config profiles with 0 or 2+ modules gracefully Instead of erroring when a profile has 0 modules, log a warning and inject a default SCA-only module so scanning can proceed. When a profile has 2+ modules, log a warning and continue with the first module. Co-Authored-By: Claude Sonnet 4.6 --- utils/getconfiguration.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/utils/getconfiguration.go b/utils/getconfiguration.go index 429ff7ec3..cc991fc04 100644 --- a/utils/getconfiguration.go +++ b/utils/getconfiguration.go @@ -538,8 +538,12 @@ func validateConfigProfile(configProfile *services.ConfigProfile) error { return errors.New("received a nil config profile") } - if len(configProfile.Modules) != 1 { - return fmt.Errorf("%s config profile returned with %d modules. A profile must have exactly 1 module", configProfile.ProfileName, len(configProfile.Modules)) + if len(configProfile.Modules) == 0 { + log.Warn(fmt.Sprintf("%s config profile returned with 0 modules. Using default module", configProfile.ProfileName)) + configProfile.Modules = createDefaultConfig() + } + if len(configProfile.Modules) > 1 { + log.Warn(fmt.Sprintf("%s config profile returned with %d modules. Only the first module will be used", configProfile.ProfileName, len(configProfile.Modules))) } if configProfile.Modules[0].PathFromRoot != "." { @@ -547,3 +551,7 @@ func validateConfigProfile(configProfile *services.ConfigProfile) error { } return nil } + +func createDefaultConfig() []services.Module { + return []services.Module{{PathFromRoot: ".", ScanConfig: services.ScanConfig{ScaScannerConfig: services.ScaScannerConfig{EnableScaScan: true}}}} +}