Describe the bug
Headlamp crashes with "Uh-oh! Something went wrong" when viewing CronJob details or the CronJob list if a CronJob does not have spec.suspend explicitly set in its manifest. Kubernetes defaults spec.suspend to false but does not always include it in the API response, causing undefined.toString() to throw a TypeError.
To Reproduce
- Have a CronJob in the cluster that does not explicitly set
spec.suspend (e.g. installed by a Helm chart that omits the field)
- Navigate to Workloads → CronJobs
- Click on the CronJob to open its details
- UI crashes with "Uh-oh! Something went wrong"
Error from browser console
TypeError: can't access property "suspend", c.spec is undefined
HBe https://headlamp.poc1.swuppi.dev/assets/index-CE3nuifS.js:1167
Root cause
Three locations access spec.suspend without a null/undefined check:
frontend/src/components/cronjob/List.tsx:69
getValue: cronJob => cronJob.spec.suspend.toString(),
frontend/src/components/cronjob/Details.tsx:152
const isCronSuspended = cronJob?.spec.suspend;
frontend/src/components/cronjob/Details.tsx:241
value: item.spec.suspend.toString(),
When the Kubernetes API omits spec.suspend (which is valid — it defaults to false), these calls throw a TypeError because .toString() is called on undefined.
Suggested fix
Use nullish coalescing to default to false when the field is missing:
List.tsx:69
- getValue: cronJob => cronJob.spec.suspend.toString(),
+ getValue: cronJob => (cronJob.spec.suspend ?? false).toString(),
Details.tsx:152
- const isCronSuspended = cronJob?.spec.suspend;
+ const isCronSuspended = cronJob?.spec?.suspend ?? false;
Details.tsx:241
- value: item.spec.suspend.toString(),
+ value: (item.spec.suspend ?? false).toString(),
Environment
Installation type: In-cluster
Headlamp version: v0.41.0
Kubernetes version: 1.31
The bug also exists on main (checked 2026-04-07)
!! This code analysis has been done by AI: Claude - A developer is needed to verify if this change does not break something.
Describe the bug
Headlamp crashes with "Uh-oh! Something went wrong" when viewing CronJob details or the CronJob list if a CronJob does not have
spec.suspendexplicitly set in its manifest. Kubernetes defaultsspec.suspendtofalsebut does not always include it in the API response, causingundefined.toString()to throw a TypeError.To Reproduce
spec.suspend(e.g. installed by a Helm chart that omits the field)Error from browser console
TypeError: can't access property "suspend", c.spec is undefined
HBe https://headlamp.poc1.swuppi.dev/assets/index-CE3nuifS.js:1167
Root cause
Three locations access
spec.suspendwithout a null/undefined check:frontend/src/components/cronjob/List.tsx:69When the Kubernetes API omits spec.suspend (which is valid — it defaults to false), these calls throw a TypeError because .toString() is called on undefined.
Suggested fix
Use nullish coalescing to default to false when the field is missing:
Environment
Installation type: In-cluster
Headlamp version: v0.41.0
Kubernetes version: 1.31
The bug also exists on main (checked 2026-04-07)
!! This code analysis has been done by AI: Claude - A developer is needed to verify if this change does not break something.