Skip to main content
The C interface reports results through return values. Functions that return int all use the five values below: RTC_OK is 0, and every failure is negative.

Values

RTC_ERROR is a catch-all failure code. Get the specific reason with rtc_get_last_error (since 0.0.9); it returns the 180xxx / 1xxx error codes described in the next two sections. You can also raise the log level to see the reason:
The logs then print a more specific error, such as 180001: Not in channel or 1021: .... The difference between these two kinds of codes is explained in the next two sections.

180xxx in logs: SDK errors

The five C return values only describe the result “at the call level” and carry no reason. Get the reason with rtc_get_last_error; it is also printed in the logs. 6-digit codes starting with 180 are errors produced by the SDK itself: 180 is the prefix for server-side / embedded integrations, and the last three digits identify the specific error and are the same across all SDKs (see Error code format for the numbering rules). Reasons for SDK errors are in English; branch on the error code, not on the message text.
Error codes were renumbered in 0.1.0 (for example, “not allowed to publish a composite stream” changed from 180004 to 180040, and 180004 now means invalid token). The table below applies to 0.1.0 and later. For the old-to-new mapping, see Changelog · 0.1.0.
When you see 180002 (token expired), first make sure the token isn’t being reused: every process needs its own issued token. This and the server’s 1032 below are two symptoms of the same kind of problem.

1xxx and similar in logs: server business error codes

Four-digit codes (≥1000) come from the server. They are business-level reasons for rejection, passed through unchanged by the SDK, for example: For the full list, see Server API · Error codes. When a publish / subscribe is rejected by the server (such as 1033 concurrency limit reached or 1035 node overloaded), rtc_get_last_error returns the server code as-is since 0.1.0 instead of wrapping it as 180300 / 180301. The language of server error reasons is set by rtc_set_language; by default it follows the system language.
A token is bound to one session, and the session is no longer valid once the process leaves the channel. Reusing the same token to start a second process gets 1032 (RTC_ERROR on the C side)—issue a separate token for every process.

Checking return values

Check the return value of every function that returns int. When a critical path such as joining the channel fails, you must run the cleanup flow to avoid leaking handles:
rtc_create / rtc_create_local_track return pointers, which are NULL on failure; just check for NULL.