Skip to content
Menu

Reference

Error codes

Markdown version

The HTTP status codes the SDK endpoints return, what the SDK does with each, and the SDK log messages worth acting on.

The SDK never throws into your app. A problem shows up in two places: an HTTP status from Herald, which the SDK handles on its own, and a line in the device log. This page lists both.

HTTP status codes

These apply to POST /api/v1/sdk/batch and GET /api/v1/sdk/messages. Every error body is { "error": "<message>" }.

StatusError messageCauseSDK behaviorFix
200Accepted. Events Herald couldn't accept are listed in rejected (see Rejected events); the rest were keptBatch removed from the queue; each rejected event logged at debug level, never retriedFix the reason in your app
304Messages unchanged (fetch only)Keeps the cached messages
400Invalid JSONThe body is not JSONBatch droppedShould not happen with the SDKs; report it
400A field path and message, such as deviceId: Too small: expected string to have >=1 charactersThe batch itself breaks the schema (a bad event is rejected on its own instead). Servers before per-event validation answered this for a bad event too, such as events[2].name: RequiredBatch droppedUpdate the SDK; the device checks should have stopped the call
400deviceId: ...Bad fetch queryCached messages keptShould not happen with the SDKs
401Invalid app keyThe key is wrong, or its connection is not activeKeeps every queued event and sends nothing more until the app launches againCopy the key again from the Mobile SDK card
401Invalid user tokenVerification is Required and the token is missing or wrong, or it is Optional and the token is wrongKeeps that user's events until the app calls setUserToken; anonymous events keep flowingMint the token from the same user ID; call setUserToken after identify; re-mint after rotating the ingest token
408Request timeout (from a proxy)Kept and retriedNone needed
413Batch exceeds 512 KB or Batch exceeds 100 eventsToo largeBatch droppedShould not happen with the SDKs; report it
429Rate limited (from a proxy or firewall)Kept and retried after Retry-AfterNone needed; check firewall rules if it persists
500Internal server errorServer failureKept and retried with backoffContact your account team if it persists
5xxServer or gateway failureKept and retried with backoffNone needed if it clears

A batch that is dropped is gone: its events are not sent again. Kept events still count toward the queue limit, so the oldest are dropped if the cause is never fixed. See Batching and offline.

Rejected events

POST /api/v1/sdk/batch and POST /api/v1/events check each event on their own. A bad event is left out and the rest are applied; the response is still 200 and lists it:

json
{ "data": { "accepted": 2, "duplicates": 0,
  "rejected": [{ "id": "e2", "index": 1, "reason": "missing_field", "detail": "events[1].name: Invalid input: expected string, received undefined" }] } }

rejected is there only when something was rejected. id is the event's ID, or null when it has no usable one; index is its position in events. Retrying never helps, so the SDKs don't retry a rejected event. Each connection's page in the console (Settings → Sending & SDK, then the connection) lists its recent rejected events under Rejected events, from the SDK or from POST /api/v1/events, kept for 30 days. Any email, phone, token, password, secret, authorization or API key field, at any depth (traits, attributes, properties), and any value that looks like an email, is blanked in the stored copy.

ReasonConsole labelCause
invalid_typeUnknown event typetype is not one the API knows
missing_fieldMissing fieldA required field is missing
invalid_fieldInvalid fieldA field has the wrong type, length or value, or the event is not an object. Includes a lifecycle event property of the wrong type, such as a from_push that isn't a boolean, and an attribute key starting with computed_, which is reserved for computed attributes
too_oldToo oldSDK events only: the event time is more than 30 days before Herald received it (after clock correction). Server events have no age limit
in_futureTime in the futureThe event time is more than 5 minutes after Herald received it. Only POST /api/v1/events can hit it: SDK event times are never later than arrival
too_largeToo largeThe event is over 32 KB as JSON. The SDKs drop such an event on the device (counted in dropped), so it comes from older SDKs or server events
schema_violationSchema violationThe event's name has an event schema in Reject invalid events mode and the event breaks it. detail names the first failing property and rule, such as properties.plan: must be one of free, pro (schema signup 1-0-0)
unknown_schema_versionUnknown schema versionThe event's schemaVersion names a version its event schema doesn't have
schema_warningSchema warning (accepted)Not a reject: the event broke a schema in Accept and warn mode and was kept. Stored for the console only (up to 200 a day, apart from the 1,000 rejects), never listed in the response's rejected
invalid_consentinvalid_consentNot an event: the batch's context.consent (SDK 0.6.0) is invalid or null, so it was left out and the batch kept. Stored with no event type and never listed in the response's rejected. The SDKs check setConsent, so it comes from other clients

New codes may be added; treat an unknown one like invalid_field.

Contacts API

POST and DELETE /api/v1/contacts, called from your backend:

StatusError messageCause
400Invalid JSONThe body is not JSON
400Invalid contacts payload: <reason> (<field>)A contact breaks a rule, such as apns token must be 64+ hex characters or phone must be E.164
401UnauthorizedMissing or unknown ingest token
403ForbiddenThe connection is inactive, or its type does not take contacts
500Internal server errorServer failure

Users and events APIs

POST /api/v1/users and POST /api/v1/events, called from your backend:

StatusError messageCause
400Invalid JSONThe body is not JSON
400Invalid users payload: ... or Invalid events payload: ...A field breaks a rule; the message names it. For events, only the request itself (not an object, no events array, 0 or over 1,000 events); a bad event is rejected on its own
401UnauthorizedMissing or unknown ingest token
403ForbiddenThe connection is disabled
413Body exceeds 4 MBToo large
500Internal server errorServer failure

SDK log messages

iOS writes to the unified log under subsystem com.herald.sdk (category Herald, and ui for HeraldUI). Android writes to Logcat with the tag Herald. The default level shows errors and warnings. See Logging and debugging.

Setup

MessagePlatformLevelMeaning
Herald.configure was called more than once; ignoring the later calliOSWarningOnly the first configuration applies
Herald.configure called more than once; ignoredAndroidWarningSame
Herald call dropped: more than 1000 calls are waiting (is Herald.configure called?)iOSWarning1,000 calls are waiting for configure; later ones are lost
More than 1000 calls before Herald.configure; dropping later ones until it runsAndroidWarningSame
Could not create storage directory: ...iOSErrorThe SDK cannot write its files; nothing persists
SDK state file unreadable; starting freshAndroidErrorThe state file was corrupt; the device starts as new

Calls rejected on the device

A call that breaks a rule is dropped and never queued. The message names the call and the problem.

Message patternPlatformLevel
<call> ignored: <problem>, for example track ignored: name must not be emptyiOSError
<call> ignored: <problem>AndroidWarning
<what> contain an unsupported value (...); call ignoredAndroidWarning
setAttributes: $email is not a valid email; dropped that keyBothWarning
setAttributes: $phone must be E.164, for example +15551234567; dropped that keyBothWarning
setLocation: latitude must be -90...90 and longitude -180...180iOSError
setLocation ignored: out of rangeAndroidWarning

Problems include must not be empty, is longer than N characters, currency must be a 3-letter ISO 4217 code, quantity must be positive (iOS) or quantity must be at least 1 (Android), price must be finite (iOS) or price is not finite (Android), and contains a number that is not finite.

Delivery

MessagePlatformLevelMeaning
Herald rejected a batch of N event(s) with HTTP S; dropping itiOSErrorA 4xx other than 408 and 429; see the status table
Herald rejected a batch (S): <body>. Dropping N events.AndroidErrorSame, with the server's message
Batch send failed: ... / Batch will be retried in N siOSInfoNetwork error or retryable status
Batch send failed (...); will retry / Batch send got S; will retryAndroidInfoSame
Sent N eventsAndroidDebugA batch was accepted
Herald rejected event <id>: <reason> (<detail>)BothDebugHerald accepted the batch but left this event out; see Rejected events
Dropping a <type> event larger than 32 KBBothDebugThe event was over the 32 KB limit; dropped before queueing and counted in dropped
Event queue full: dropped N oldest event(s)iOSWarningThe 1,000-event queue overflowed; the count is reported to Herald
Dropped N queued event(s) older than 30 daysBothDebugSDK 0.6.0 and later: queued events past maxQueuedEventAge were dropped before a batch was built and counted in dropped
Dropping an event larger than 512 KBiOSErrorOne event cannot fit in a batch
Collection is turned off remotelyBothInfoSDK 0.6.0 and later: the app's SDK settings turned off "Collect events"; the queue was cleared and nothing is recorded or sent until it is turned back on
Config fetch failed (...); keeping the current config / Config fetch returned an unreadable bodyAndroidInfo / WarningThe remote config fetch failed; the cached or built-in settings stay
Could not cache the remote config: ... / Could not cache the remote configiOS / AndroidErrorDisk write failed; the fetched settings still apply until the app quits
Skipping an event that cannot be encoded as JSONiOSErrorFor example a NaN in properties
Could not persist event: ... / Could not persist event queueiOS / AndroidErrorDisk write failed

Messages

MessagePlatformLevelMeaning
Message sync failed with HTTP S / Message sync got S: <body>iOS / AndroidWarningThe fetch failed; cached messages stay
Message sync failed: ... / Message sync failed (...); using cached messagesiOS / AndroidInfoNetwork error
Message sync needs a user token; waiting for setUserTokenBothDebugA signed-in fetch without a token got 401; setUserToken fetches again
Message sync waits for setUserTokenBothDebugThe connection requires a user token and none is set yet, so no fetch is sent
Message sync failed with HTTP 401: Herald refused the user token / Message sync got 401: Herald refused the user tokeniOS / AndroidWarningThe token sent was wrong
Messages unchangedBothDebug304 from the server
Message sync returned an unreadable bodyAndroidWarningThe response could not be parsed
Skipping malformed <type>: ... / Skipping malformed message at index NiOS / AndroidWarningOne card or message could not be read, for example an unknown type; the rest load
In-app message X not shown (no presenter or no active scene); stays pendingiOSInfoSet a presenter, or the app was not active
In-app message X discarded by delegateAndroidDebugYour delegate returned discard
InAppMessageDelegate threw; displayingAndroidErrorYour delegate crashed; the message was shown
InAppMessagePresenter threw / In-app display failedAndroidErrorYour presenter crashed; the message stays pending
Unknown content card XAndroidWarningA log call for a card the SDK no longer has
debugLoadMessages: unreadable bodyBothWarningThe debug JSON is not a messages response
Card impression <id>iOS (ui)DebugThe default feed logged an impression

Push and UI (Android modules)

MessageModuleMeaning
Firebase is not initialized; push token not syncedherald-fcmgoogle-services.json is missing or the Google services plugin is not applied
FCM token sync failedherald-fcmFirebase could not return a token
Could not show Herald notificationherald-fcmBuilding the notification failed
Notification image failed (...) / Notification image too large to decodeherald-fcmThe push shows without its image
Image load failed for <host> (...) / Image too large to decode from <host>herald-uiA card or message image did not load
WebView unavailable; HTML message closed / HTML message renderer gone; message closedherald-uiThe HTML message could not run
openUrl failedherald-coreNo activity handles the URL

See Herald decide live →