@@ -573,15 +573,39 @@ func (a *OllamaAgent) aggregatePodFiles(bundle *analyzer.SupportBundle, filePath
573573 namespace = strings .TrimSuffix (parts [len (parts )- 1 ], ".json" )
574574 }
575575
576- // Parse pod list
576+ // Parse pod data - handle both PodList and single Pod objects
577577 var podList map [string ]interface {}
578578 if err := json .Unmarshal (data , & podList ); err != nil {
579579 continue
580580 }
581581
582+ // Check if this is a List object with items array
582583 items , ok := podList ["items" ].([]interface {})
583584 if ! ok {
584- namespaceStats [namespace ] = 0
585+ // Check if this is a single Pod object (has "kind": "Pod")
586+ if kind , exists := podList ["kind" ].(string ); exists && kind == "Pod" {
587+ // Single pod - count as 1
588+ namespaceStats [namespace ] = 1
589+ totalPods ++
590+ // Extract status for single pod
591+ if status , ok := podList ["status" ].(map [string ]interface {}); ok {
592+ if phase , ok := status ["phase" ].(string ); ok {
593+ switch phase {
594+ case "Running" :
595+ runningPods ++
596+ case "Pending" :
597+ pendingPods ++
598+ case "Failed" :
599+ failedPods ++
600+ case "Succeeded" :
601+ succeededPods ++
602+ }
603+ }
604+ }
605+ } else {
606+ // Not a pod list or single pod, skip
607+ namespaceStats [namespace ] = 0
608+ }
585609 continue
586610 }
587611
@@ -663,14 +687,24 @@ func (a *OllamaAgent) aggregateDeploymentFiles(bundle *analyzer.SupportBundle, f
663687 namespace = strings .TrimSuffix (parts [len (parts )- 1 ], ".json" )
664688 }
665689
690+ // Parse deployment data - handle both DeploymentList and single Deployment objects
666691 var deploymentList map [string ]interface {}
667692 if err := json .Unmarshal (data , & deploymentList ); err != nil {
668693 continue
669694 }
670695
696+ // Check if this is a List object with items array
671697 items , ok := deploymentList ["items" ].([]interface {})
672698 if ! ok {
673- namespaceStats [namespace ] = 0
699+ // Check if this is a single Deployment object (has "kind": "Deployment")
700+ if kind , exists := deploymentList ["kind" ].(string ); exists && kind == "Deployment" {
701+ // Single deployment - count as 1
702+ namespaceStats [namespace ] = 1
703+ totalDeployments ++
704+ } else {
705+ // Not a deployment list or single deployment, skip
706+ namespaceStats [namespace ] = 0
707+ }
674708 continue
675709 }
676710
@@ -710,21 +744,23 @@ func (a *OllamaAgent) aggregateEventFiles(bundle *analyzer.SupportBundle, filePa
710744 continue
711745 }
712746
747+ // Parse event data - handle both EventList and single Event objects
713748 var eventList map [string ]interface {}
714749 if err := json .Unmarshal (data , & eventList ); err != nil {
715750 continue
716751 }
717752
753+ // Check if this is a List object with items array
718754 items , ok := eventList ["items" ].([]interface {})
719755 if ok {
720756 itemCount := len (items )
721757 totalEvents += itemCount
722- // Include actual event data for AI analysis (limited)
758+ // Include actual event data for AI analysis (limited to 50 events max )
723759 // Only include if we haven't reached the limit and the data is reasonable size
724760 if itemCount > 0 && eventsIncluded < 50 {
725761 dataStr := string (data )
726- // Only include if data size is reasonable and we won't exceed limit too much
727- if len (dataStr ) < 2000 && (eventsIncluded + itemCount ) <= 100 {
762+ // Only include if data size is reasonable and won't exceed 50 event limit
763+ if len (dataStr ) < 2000 && (eventsIncluded + itemCount ) <= 50 {
728764 summary .WriteString (fmt .Sprintf ("\n --- Events from %s ---\n " , filePath ))
729765 summary .WriteString (dataStr )
730766 summary .WriteString ("\n " )
@@ -769,7 +805,7 @@ func (a *OllamaAgent) runLLMAnalysis(ctx context.Context, bundle *analyzer.Suppo
769805 // Check if this is an aggregated analyzer (multiple files)
770806 if aggregated , ok := spec .Config ["aggregated" ].(bool ); ok && aggregated {
771807 // Handle aggregated files
772- if filePaths , ok := spec .Config ["filePaths" ].([]string ); ok {
808+ if filePaths , ok := spec .Config ["filePaths" ].([]string ); ok && len ( filePaths ) > 0 {
773809 aggregatedData , err := a .aggregateFiles (bundle , filePaths , spec .Category )
774810 if err != nil {
775811 return & analyzer.AnalyzerResult {
@@ -780,6 +816,14 @@ func (a *OllamaAgent) runLLMAnalysis(ctx context.Context, bundle *analyzer.Suppo
780816 }, nil
781817 }
782818 dataStr = aggregatedData
819+ } else {
820+ // Missing or invalid filePaths for aggregated analyzer
821+ return & analyzer.AnalyzerResult {
822+ Title : spec .Name ,
823+ IsWarn : true ,
824+ Message : "Aggregated analyzer missing valid filePaths configuration" ,
825+ Category : spec .Category ,
826+ }, nil
783827 }
784828 } else {
785829 // Smart file detection for enhanced analyzer compatibility (single file)
0 commit comments