Embedding
Errors
The SDK surfaces all failures through the onError callback. Handle them — and learn the codes — so a misconfigured embed never silently breaks.
Listening for errors
js
Playgent.init({
containerId: "playgent-host",
game: "sudoku",
mode: "daily",
onError: ({ code, message, recoverable }) => {
if (recoverable) {
// The SDK shows a Retry button. You may want to log the attempt.
} else {
Sentry.captureMessage(`Playgent ${code}: ${message}`);
}
},
});
Codes you'll see most
| Code | Meaning | Fix |
|---|---|---|
invalid_game | Missing or malformed game. | Provide a valid game ID like sudoku. |
unknown_game | Game ID isn't in the catalog. | Check spelling against the Hub catalog. |
invalid_mode | mode isn't one of pinned, daily, random. | Pick one of the three runtime modes. |
unsupported_mode | This game doesn't support that mode (e.g. seeded game with daily). | Switch to a supported mode. |
invalid_content_ref | Pinned mode without a content value. | Provide a pub_… ID. |
publication_fetch_failed | The publication isn't published or doesn't exist. | Verify the pub_… ID is published. |
channel_fetch_failed | Channel doesn't exist for that language. | Verify the cha_… ID and language. |
channel_empty | Daily channel has no scheduled puzzle for today. | Use a different channel or different mode. |
game_load_failed | Iframe failed to load (network, CSP, etc.). | Check your CSP and origin allowlist. |
Recoverable vs. fatal
recoverable: true means the SDK already shows a Retry button to the user — typically network issues or transient fetch failures. You don't need to retry yourself; just log and move on.
recoverable: false means the embed is misconfigured. The user sees a static error screen. Catch these in dev and CI.
Full reference
Every error code, including triggers and HTTP-equivalent context, is on the SDK Error codes page.