diff --git a/docs/samples/contact-center/app.js b/docs/samples/contact-center/app.js
index 2000f2427d7..474f8004a61 100644
--- a/docs/samples/contact-center/app.js
+++ b/docs/samples/contact-center/app.js
@@ -189,7 +189,13 @@ async function fetchBuddyAgents() {
buddyAgentsDropdownElm.innerHTML = ''; // Clear previous options
const buddyAgentsResponse = await webex.cc.getBuddyAgents({mediaType: 'telephony'});
- if (buddyAgentsResponse.data && buddyAgentsResponse.data.agentList.length === 0) {
+ if (!buddyAgentsResponse || !buddyAgentsResponse.data) {
+ console.error('Failed to fetch buddy agents');
+ buddyAgentsDropdownElm.innerHTML = `