# Errors One numbered table on every platform. Every error is an NGAError with a code, a stable detail string, its cause and fix, and whether trying again can help. *NGA SDK 0.1.0 preview: you install 0.1.0 from Maven Central and NGA's public repositories. Every 0.x version is a preview under the NGA SDK License, and the API can change until 1.0. Questions: hi@nga.network. This page: https://nga.io/docs/sdk/reference/errors/* ## Codes The integers never change, and a new code takes the next free integer in its range: - 1xx: integration and configuration; you fix these. - 2xx: network, server and internal; usually temporary. - 3xx: loading and showing ads. | Integer | Kotlin, Java | Swift | Objective-C | C# | | --- | --- | --- | --- | --- | | 100 | `NOT_INITIALIZED` | `.notInitialized` | `NGAErrorCodeNotInitialized` | `NotInitialized` | | 101 | `INVALID_CONFIG` | `.invalidConfig` | `NGAErrorCodeInvalidConfig` | `InvalidConfig` | | 102 | `INVALID_ARGUMENT` | `.invalidArgument` | `NGAErrorCodeInvalidArgument` | `InvalidArgument` | | 103 | `DISABLED` | `.disabled` | `NGAErrorCodeDisabled` | `Disabled` | | 104 | `RENDER_NOT_AVAILABLE` | `.renderNotAvailable` | `NGAErrorCodeRenderNotAvailable` | `RenderNotAvailable` | | 200 | `NETWORK` | `.network` | `NGAErrorCodeNetwork` | `Network` | | 201 | `TIMEOUT` | `.timeout` | `NGAErrorCodeTimeout` | `Timeout` | | 202 | `SERVER_REJECTED` | `.serverRejected` | `NGAErrorCodeServerRejected` | `ServerRejected` | | 299 | `INTERNAL` | `.internal` | `NGAErrorCodeInternal` | `Internal` | | 300 | `INVALID_PLACEMENT` | `.invalidPlacement` | `NGAErrorCodeInvalidPlacement` | `InvalidPlacement` | | 301 | `NO_FILL` | `.noFill` | `NGAErrorCodeNoFill` | `NoFill` | | 302 | `EXPIRED` | `.expired` | `NGAErrorCodeExpired` | `Expired` | | 303 | `AD_CONSUMED` | `.adConsumed` | `NGAErrorCodeAdConsumed` | `AdConsumed` | | 304 | `NOT_READY` | `.notReady` | `NGAErrorCodeNotReady` | `NotReady` | | 305 | `ALREADY_SHOWING` | `.alreadyShowing` | `NGAErrorCodeAlreadyShowing` | `AlreadyShowing` | | 306 | `ACTIVITY_NOT_RESUMED` | `.activityNotResumed` | `NGAErrorCodeActivityNotResumed` | `ActivityNotResumed` | | 307 | `RENDER_FAILED` | `.renderFailed` | `NGAErrorCodeRenderFailed` | `RenderFailed` | | 308 | `INVALID_SHOW_TARGET` | `.invalidShowTarget` | `NGAErrorCodeInvalidShowTarget` | `InvalidShowTarget` | To log a code's name: `code.name` (Kotlin, Swift) returns the Kotlin-column name, such as `NO_FILL`; `Code.ToString()` (C#) returns the C# name. The `detail` strings are stable too: branch on them. ## Details One row per `detail`: where it is raised, its cause, its fix, and whether a retry can help. ### Integration and configuration (1xx) | Code | `detail` | Raised by | Cause | Fix | `retryable` | | --- | --- | --- | --- | --- | --- | | `NOT_INITIALIZED` 100 | `queue.full` | any call with a callback, before init | 200 calls were already waiting for init | call `initialize` first; look for a call in a loop | no | | | `init.failed` | calls that waited for a failed init | init failed; the call that waited for it gets this | if `retryable`, init keeps retrying on its own: call again later; otherwise fix what `onInitialized` reported | yes after a retryable init failure; otherwise no | | | `queue.discarded` | `onError` | init failed permanently, and the calls waiting for it were thrown away; the message gives the count | fix the app key; those calls then work | no | | `INVALID_CONFIG` 101 | `app_key.format` | `initialize` | the key is not `app_` and 8 to 64 letters or digits, or is null | use the game's key from the portal | no | | | `app_key.changed` | `initialize` | `initialize` again with another key | one key per game, on both platforms | no | | | `app_key.unknown` | `initialize` | the server does not know the key, the game is not registered for this build's platform, or this release build's package name or bundle id is not the one registered for the game | check the key; add the platform on the game's *Overview*; check its *Store and builds* in the portal | no | | | `platform.unsupported` | `initialize` | an Android process other than the main one, an iOS app extension, or Unity outside an Android or iOS player (the Editor) | initialize in the main app; test Unity on a device | no | | `INVALID_ARGUMENT` 102 | `ad_revenue.revenue` | `logAdRevenue` | `revenueMicros` below 0 | pass 0 or more | no | | | `ad_revenue.currency` | `logAdRevenue` | not three letters | pass the ISO code, such as `USD` | no | | | `ad_revenue.length` | `logAdRevenue` | a string field over 200 characters | shorten it | no | | | `customer_user_id.length` | `setCustomerUserId` | empty, or over 128 characters | pass 1 to 128 characters, or null to remove the id | no | | | `customer_user_id.format` | `setCustomerUserId` | contains a NUL character | remove it | no | | | `purchase.jws` | `logPurchase` (iOS, C#) | the string is not a StoreKit 2 transaction's JWS | pass `jwsRepresentation` from the order | no | | | `argument.null` | `logAdRevenue`, C# `LogPurchase` | null was passed | pass a value | no | | `DISABLED` 103 | `app_key.disabled` | `initialize`, `loadAd`, `onError` | the app key is switched off; collection stops, and loaded ads expire | contact NGA; the SDK resumes at the next launch or foreground once the key is on | no | | | `sdk.retired` | `initialize`, `loadAd`, `onError` | NGA has retired this SDK version or build; loaded ads expire | update the SDK | no | | `RENDER_NOT_AVAILABLE` 104 | `render.absent` | `loadAd` | the render library is not in the build | add it ([Install](https://nga.io/docs/sdk/install/)) | no | | | `render.version_mismatch` | `loadAd` | the render library is at another version than the core library, or, from 0.1.0-rc.3 on, from another build of that version (two candidates, or the release and a candidate before 0.1.0-rc.6); everything else works | use one version, from one release, for both | no | | | `render.init_failed` | `loadAd` | the render library failed to start | update both libraries; contact NGA | no | | | `webview.unavailable` | full-screen `loadAd` and `show` (Android) | no usable WebView right now: missing, disabled or updating | try again later; the banner is unaffected | yes | ### Network and server (2xx) | Code | `detail` | Raised by | Cause | Fix | `retryable` | | --- | --- | --- | --- | --- | --- | | `NETWORK` 200 | `init.unreachable` | `initialize` | no network at init, and no saved configuration | none: init keeps retrying | yes | | | `ad.unreachable` | `loadAd` | the ad request could not be sent | load again later | yes | | | `asset.download` | `loadAd` | an ad's file download was cut short | load again later; files already fetched are kept | yes | | `TIMEOUT` 201 | `init.timeout` | `initialize` | init timed out, and no saved configuration | none: init keeps retrying | yes | | | `ad.timeout` | `loadAd` | the ad and its files did not arrive within 60 seconds | load again later | yes | | `SERVER_REJECTED` 202 | `init.http_NNN` | `initialize` | init was answered with HTTP status *NNN* | none: init keeps retrying | yes | | | `config.signature`, `config.key_unknown` | `initialize` | the configuration NGA sent could not be verified | none: init keeps retrying; contact NGA if it persists | yes | | | `ad.http_NNN` | `loadAd` | the ad request was answered with HTTP status *NNN* | load again later for a 5xx; otherwise contact NGA | yes for a 5xx; otherwise no | | | `ad.schema` | `loadAd` | the ad NGA sent is incomplete | load again later; contact NGA if it persists | yes | | | `asset.hash` | `loadAd` | a downloaded file did not match | contact NGA | no | | `INTERNAL` 299 | `init.parse` | `initialize` | NGA's configuration did not parse | none: init keeps retrying | yes | | | `event_queue.reset` | `onError` | the SDK's event store was damaged on the device and has been reset | none: collection continues | no | | | `cache.write` | `loadAd` | an ad's files could not be saved, for example the disk is full | load again later | yes | `init.http_NNN` and `ad.http_NNN` carry the HTTP status in place of `NNN`, for example `ad.http_503`. ### Loading and showing ads (3xx) | Code | `detail` | Raised by | Cause | Fix | `retryable` | | --- | --- | --- | --- | --- | --- | | `INVALID_PLACEMENT` 300 | `placement.format` | `loadAd` | the id is not `plc_` and 3 to 64 lower-case letters, digits or `_`, or is null | use the placement's id from the portal | no | | | `placement.unknown` | `loadAd` | not one of this game's placements | check the id against the game's *Placements*; a placement you have just added reaches the game at its next launch | yes, with no wait | | `NO_FILL` 301 | `no_fill.decision` | `loadAd` | NGA had no ad for this request | load again after `retryAfterMillis` | yes, after `retryAfterMillis` when it is set | | | `no_fill.cap` | `loadAd` | the placement is at one of its [caps](https://nga.io/docs/sdk/portal/#caps) | `retryAfterMillis` says when it reopens; null for a per-session cap | yes, after `retryAfterMillis` when it is set | | | `no_fill.unsupported` | `loadAd` | the ad needs a newer SDK | update the SDK | yes, after `retryAfterMillis` when it is set | | | `no_fill.rate_limited` | `loadAd` | too many requests | load again after `retryAfterMillis` | yes, after `retryAfterMillis` when it is set | | `EXPIRED` 302 | `show.state.expired` | `show` | shown after it expired, or its files were cleared from the device's cache | load again | no | | `AD_CONSUMED` 303 | `show.state.consumed` | `show` | this ad was already shown | load again | no | | `NOT_READY` 304 | `show.state.failed` | `show` | this ad failed earlier | load again | no | | `ALREADY_SHOWING` 305 | `show.already_showing.same_handle` | `show` | this ad is already showing | wait for its `onClosed` | no | | | `show.already_showing.fullscreen` | `show` | another NGA full-screen ad is on screen | wait for its `onClosed`; this ad stays ready | no | | | `show.already_showing.banner` | `show` | another native banner is on screen | close it, or wait for its `onClosed`; this ad stays ready | no | | `ACTIVITY_NOT_RESUMED` 306 | `show.activity.not_resumed` | `show` | the Activity or view controller passed to `show` cannot present now, or is null | show from the screen in front; the ad stays ready | no | | `RENDER_FAILED` 307 | `render.crashed` | `show` | the ad's renderer stopped and a second try failed; an impression or reward already counted stands | load again | no | | | `render.input` | `show` | the banner could not draw what it received | load again | no | | | `render.exception` | `show` | a failure inside the SDK's own drawing or screen code ended the show, before or after its impression; an impression already counted stands | load again; contact NGA if it repeats | no | | `INVALID_SHOW_TARGET` 308 | `show.target.window_too_small` | `show` (the banner) | the window is under 320 × 133 dp | show it when the window is bigger; the ad stays ready | no | | | `show.target.yield_failed` | `show` (the banner) | your [banner yield](https://nga.io/docs/sdk/native-cross-promo/#your-own-banner-ad)'s `hide` threw, or in Unity was not back within a second | fix `hide`; `restore` was called, and the ad stays ready | no | Every show error has `retryable` false except `webview.unavailable`. What a refused show leaves behind: [After `onShowFailed`](https://nga.io/docs/sdk/reference/callbacks/#ngaadshowlistener). ## `retryAfterMillis` Set only when a wait is known: - `NO_FILL` from the server: the server's wait. - `NO_FILL / no_fill.cap`: the time until a per-day or minimum-interval cap reopens. Null for a per-session cap, which reopens at the next session. - A `loadAd` during a server's wait fails immediately with `NO_FILL` and the time remaining, and sends no request. **Retrying a load yourself:** only when `retryAfterMillis` is set, and only after it passes. The SDK retries on its own for placements with prefetch on and for retryable init failures. ## Where errors arrive | Call | Errors reach you through | | --- | --- | | `initialize` | `onInitialized(result)`, as `result.error` | | after init | `NGAListener.onError` | | `loadAd` | `onFailed(placementId, error)` | | `show` | `onShowFailed(ad, error)` | | `setCustomerUserId`, `logAdRevenue`, `logPurchase` | the returned `NGAResult`'s `error` | No call throws.