Skip to main content

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:
You’ll see something like:
Each line maps to a category of question: The same snapshot is also returned as a serializable object you can pipe to support tooling:
Sensitive fields (userToken, apiKey) are reduced to presence flags, never echoed, so the snapshot is safe to share.

Common issues

”The widget never appears”

Run window.HaloAgents.getInstance()?.debug(). If it returns undefined, the SDK isn’t initialized:
  1. Check that the <script> tag for cdn.haloagents.ai/sdk/latest/haloagents.umd.js is actually loading. Open the network tab, refresh, and look for it. If the request fails with a CSP violation, see Content Security Policy.
  2. Check that window.HaloAgents.init({ orgId: "...", apiKey: "ab_live_..." }) is being called. Browser console: typeof window.HaloAgents should be "object".
  3. Confirm init() is called only once. A second call without destroy() is a no-op and logs a warning.
  4. Check whether something else on the page is calling destroy(). After destroy() there is no instance until init() runs again.
If 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 a userId together with a userToken (or getUserToken). Since SDK 0.10.20 the console says so, and the widget appears as soon as identify(userId, traits, { userToken }) supplies them; on earlier versions pass them to init().
  • 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 visitors or could not check who can see this agent. Look at POST /api/sdk/visibility in the network tab. The check runs again after identify() or identifyCompany().
  • The config request failed. The agent: line reads not loaded yet and onError receives HaloAgents: failed to load agent config; widget not shown. Look at GET /api/sdk/config in the network tab: a 404 means 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, so debug() 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”

Run debug() 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:
  1. init() was deferred until the user clicked Contact Support. In-app messages only fetch after init() runs. Call init() on page load and use openChat() on your button click instead.
  2. The embedder opted out. Run HaloAgents.getInstance()?.debug() and check ui flags.inAppMessages. If it’s false, the host set ui: { inAppMessages: false } (or pinned an SDK version before 0.9.0 with ui: 'manual').
  3. Audience / identify. Segment- or field-targeted messages require identify() with a matching user. Check user= in the debug() output.
  4. Previously dismissed. In-app dismissals persist in localStorage under haloagents_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:
Run 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 second init() if you genuinely want to reinitialize with new config.
Since SDK 0.10.20, a React effect that calls 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, and localhost 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:
You’re hitting origin lockdown. Two fixes:
  1. Add a loopback entry to your allow-list. Go to Setup → Install → Allowed Domains in the dashboard and add 127.0.0.1 or localhost. Then run your dev server on the host you added (http://127.0.0.1:3000 or http://localhost:3000).
  2. 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.
See Origin allow-list for the full model.

”Voice doesn’t work / microphone errors”

Microphone access requires Permissions-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 to init() 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:
Fix the spelling. Without the fix, the feature you intended to use is silently disabled. Wrong shape. The validator catches obvious type mistakes for the small set of fields where the wrong shape silently disables a feature instead of throwing:
Fix the shape (e.g. wrap a single pattern in an array: manualOnPaths: ["/app/*"]).

Reporting a bug

When something genuinely seems wrong, the most useful bug report includes:
  1. Output of HaloAgents.getInstance().debug() (full snapshot, structured object).
  2. The pathname where the issue reproduces.
  3. Browser console errors (red), if any.
  4. What you expected vs. what happened.
Email this to support@haloagents.ai or open a ticket from the Help & Support page.