Step 1: Call debug()
When the widget isn’t behaving the way you expect, the first thing to do is grab a snapshot of its current state. Open your browser console on the page where the widget should be and run:
The same snapshot is also returned as a serializable object you can pipe to support tooling:
userToken, apiKey) are reduced to presence flags, never echoed, so the snapshot is safe to share.
Common issues
”The widget never appears”
Runwindow.HaloAgents.getInstance()?.debug(). If it returns undefined, the SDK isn’t initialized:
- Check that the
<script>tag forcdn.haloagents.ai/sdk/latest/haloagents.umd.jsis actually loading. Open the network tab, refresh, and look for it. If the request fails with a CSP violation, see Content Security Policy. - Check that
window.HaloAgents.init({ orgId: "...", apiKey: "ab_live_..." })is being called. Browser console:typeof window.HaloAgentsshould be"object". - Confirm
init()is called only once. A second call withoutdestroy()is a no-op and logs a warning. - Check whether something else on the page is calling
destroy(). Afterdestroy()there is no instance untilinit()runs again.
debug() returns a snapshot but it shows dom: host=false, the SDK is running and removed the widget itself. There are four causes:
- The agent has Signed-in visitors only on and the visitor has no signed identity. The
agent:line ends in[requireAuth]. The widget stays hidden until the SDK has auserIdtogether with auserToken(orgetUserToken). Since SDK 0.10.20 the console says so, and the widget appears as soon asidentify(userId, traits, { userToken })supplies them; on earlier versions pass them toinit(). - A Page URL rule excludes this page. See the next section.
- The agent is limited to certain visitors and this one does not match. Since SDK 0.10.26 the widget asks Halo before it shows an agent that has “Only visitors who match” conditions, and stays hidden when the answer is no, when the visitor is not identified, or when that request fails. The console says
this agent is limited to certain visitorsorcould not check who can see this agent. Look atPOST /api/sdk/visibilityin the network tab. The check runs again afteridentify()oridentifyCompany(). - The config request failed. The
agent:line readsnot loaded yetandonErrorreceivesHaloAgents: failed to load agent config; widget not shown. Look atGET /api/sdk/configin the network tab: a404means the workspace has no active agent for the widget, and a blocked or failed request means the browser could not reach Halo (often CSP).
”The widget appears but messages fail with 401”
init() was called without apiKey, or with a key that was regenerated. The widget’s configuration loads without a key, so the launcher still appears, but chat and event requests need it. Copy the current widget key from Setup > Install and pass it as apiKey. Since SDK 0.10.20, init() prints a console warning when apiKey is missing.
”window.HaloAgents is undefined / getInstance() returns null”
window.HaloAgents exists as soon as the SDK script has run. If it is undefined, your code ran before the script did. That happens when the script tag has async or defer, or is added by a framework after your code. Call init() from the script’s load event instead (onload on the tag, onReady on next/script, script.onload for a tag you create). You do not need to poll for the global: it is defined by the time the event fires, and it queues init() and any calls on the instance until the widget is ready.
getInstance() returns null until init() has been called, and again after destroy(). If your identify code can run before init(), order the two, or pass the user to init() instead.
See Async loading for a full example, and the framework guides for Next.js and React.
”The widget appears on marketing pages but not on /app/*”
Check the agent’s Page URL Rules in the dashboard (Agents → [Agent] → Channels → Chat Widget → Configure). If a rule excludes the current path, the widget is removed from the page. The SDK instance stays alive, sodebug() still returns a snapshot, with dom: host=false. Since SDK 0.10.20 the rules are checked again when the route changes, so the widget comes back on an allowed page without a reload.
If the snapshot shows dom: host=true but trigger=false, you’ve likely set ui: { trigger: false }, ui: 'manual', or a manualOnPaths pattern that matches this path. Look at ui flags to confirm. Since SDK 0.10.20 manualOnPaths is re-evaluated on client-side navigation; on earlier versions the launcher was decided once, when init() ran.
”Identify isn’t working / users show as Anonymous”
Rundebug() and check the user= line. Three failure modes:
”My in-app message didn’t show (hidden widget / Contact Support button)”
In-app messages render independently of the floating launcher. They do not require the chat panel to be open. Common causes:init()was deferred until the user clicked Contact Support. In-app messages only fetch afterinit()runs. Callinit()on page load and useopenChat()on your button click instead.- The embedder opted out. Run
HaloAgents.getInstance()?.debug()and checkui flags.inAppMessages. If it’sfalse, the host setui: { inAppMessages: false }(or pinned an SDK version before 0.9.0 withui: 'manual'). - Audience / identify. Segment- or field-targeted messages require
identify()with a matching user. Checkuser=in thedebug()output. - Previously dismissed. In-app dismissals persist in
localStorageunderhaloagents_dismissed_{orgId}.
”I want zero overlays in manual mode (SDK ≥ 0.9.0)”
Since 0.9.0,ui: 'manual' and manualOnPaths allow dashboard banners and in-app messages by default. To restore the old behavior, pass a ui object with explicit opt-outs:
debug() and confirm banners=false and inAppMessages=false.
”I set ui: 'manual' but a banner still showed up (SDK < 0.9.0)”
In SDK 0.5.1 through 0.8.x, ui: 'manual' suppressed banners and in-app messages. If you’re on ≥ 0.9.0, that is expected: manual mode now allows dashboard outreach. Upgrade intentionally or add the opt-out flags above if you want zero overlays.
”Console says ‘HaloAgents is already initialized’”
HaloAgents.init() was called twice without an intervening destroy(). The second call is a no-op and returns the existing instance, so the widget continues working with the first config (not the second).
In SPAs this usually means init() is being called inside an effect that re-runs. Either:
- Move
init()to a singleton guard outside React/Vue lifecycles, or - Call
HaloAgents.getInstance()?.destroy()before the secondinit()if you genuinely want to reinitialize with new config.
init() and returns () => HaloAgents.getInstance()?.destroy() as its cleanup also works under StrictMode.
”Chat works on localhost but is blocked in production”
Almost always CSP. Open the production page, open DevTools console, look for messages mentioning “Content Security Policy” or “Refused to connect”. The fix is documented at Content Security Policy.”Chat works in production but is blocked on localhost”
Inverse of the CSP case, and the cause is almost always Allowed Domains (origin lockdown). When that feature is on, every SDK request that carries your widget key (chat, events, identify, tickets) is rejected with a 403 when it comes from a domain not in the list, andlocalhost will never match a production hostname. The widget itself still appears, because GET /api/sdk/config is not checked against the list.
Open DevTools → Network. If a request such as POST /api/sdk/events or POST /api/sdk/chat/stream fails with status 403 and a body like:
- Add a loopback entry to your allow-list. Go to Setup → Install → Allowed Domains in the dashboard and add
127.0.0.1orlocalhost. Then run your dev server on the host you added (http://127.0.0.1:3000orhttp://localhost:3000). - Disable Allowed Domains while developing. Toggle it off in the dashboard. The widget will accept any origin until you re-enable it, and your saved list is kept for when you do. Identity Verification (the per-user JWT defense) keeps working independently.
”Voice doesn’t work / microphone errors”
Microphone access requiresPermissions-Policy: microphone=(self) on the page (or the parent if the SDK is iframed). See Microphone permissions.
”I see ‘config issue’ warnings on init”
SDK 0.6.0+ validates the config object you pass toinit() and surfaces three classes of issue as a single grouped console.warn. The widget keeps working in every case; the warning just makes mistakes visible that previously failed silently.
Typo. A common typo gets a “did you mean?” suggestion when there’s a near match:
manualOnPaths: ["/app/*"]).
Reporting a bug
When something genuinely seems wrong, the most useful bug report includes:- Output of
HaloAgents.getInstance().debug()(full snapshot, structured object). - The pathname where the issue reproduces.
- Browser console errors (red), if any.
- What you expected vs. what happened.