> ## Documentation Index
> Fetch the complete documentation index at: https://developer.suki.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Mobile SDK Error Messages

> Learn about the error messages returned by the Suki Mobile SDK

This page lists the error cases returned by `SukiAmbientCoreError` in the Mobile SDK. Use these identifiers when you handle errors in your integration.

```swift Swift theme={"theme":{"light":"github-dark","dark":"material-theme-darker"}}
do {
  // Mobile SDK call
} catch let error as SukiAmbientCoreError {
  switch error {
  case .SDKNotInitilized(let nested):
    // Inspect nested for init or auth failure details
    print(nested)
  case .sessionInProgress:
    // Finish or cancel the active session first
    break
  default:
    break
  }
}
```

Each table row lists an **error id**: the `SukiAmbientCoreError` case name. Match on the case in your `switch` or error handler. Cases with associated values include the parameter label in parentheses, for example `SDKNotInitilized(error:)` or `remoteSessionConflict(blockingSessionId:)`.

## Initialization and authentication

These errors can occur while initializing the SDK or validating partner and provider details.

| Error id                   | Description                                                                     |
| :------------------------- | :------------------------------------------------------------------------------ |
| `SDKAlreadyInitilized`     | `initialize()` was called when the SDK is already initialized                   |
| `SDKNotInitilized(error:)` | SDK is not initialized, or init/auth failed. Check the nested error for details |
| `invalidPartnerId`         | `PartnerId` is missing from the dictionary passed to `initialize()`             |
| `invalidProviderDetails`   | `ProviderInfo` is missing or invalid in the init dictionary                     |

## Session lifecycle

These errors can occur while creating, clearing, or managing ambient sessions.

| Error id                                    | Description                                                                                                                                                     |
| :------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `sessionInProgress`                         | A session is already active on this device. Finish or cancel it before creating a new one or calling `clear()`. Local only. No EMR encounter id required.       |
| `noSessionExist`                            | No valid session exists, or the session is in the wrong state for this operation                                                                                |
| `remoteSessionConflict(blockingSessionId:)` | Another client holds an active session for this encounter. Use `blockingSessionId` with `cancelRemoteAmbientSession` or `endSessionRemotely`, then retry create |

## Create session status failures

These create failures return **`SukiStatus`** and do **not** fall back to an offline session.

| Status                | Typical code | Description                                                                                                |
| :-------------------- | :----------- | :--------------------------------------------------------------------------------------------------------- |
| `FAILED_PRECONDITION` | `9`          | Backend rejected create (for example re-ambient on a submitted note). Message text comes from the backend. |
| `INVALID_ARGUMENT`    | `3`          | Backend rejected create (for example a bad encounter UUID). Message text comes from the backend.           |

## Context and catalog validation

These errors can occur while setting session context, diagnoses, medications, or personalization preferences.

| Error id                  | Description                                                                           |
| :------------------------ | :------------------------------------------------------------------------------------ |
| `invalidContext`          | `setSessionContext()` was called with an empty context (all fields nil)               |
| `invalidSections(error:)` | A note section has an invalid or unsupported `code` / `code_type`                     |
| `invalidSpeciality`       | Provider specialty is not in the server-supported catalog                             |
| `invalidProviderRole`     | Provider role is not in the server-supported catalog                                  |
| `invalidVisitType`        | Visit type is not in the server-supported catalog                                     |
| `invalidEncounterType`    | Encounter type is not in the server-supported catalog                                 |
| `invalidBirthdate`        | Patient birthdate is not a valid `Date` in context                                    |
| `noValidDiagnosis`        | Diagnosis context is empty or contains unsupported code types                         |
| `missingDiagnosisCodes`   | A diagnosis entry is missing its `codes` array                                        |
| `missingCodeFields`       | A diagnosis code is missing required fields (`code_type`, `code`, `code_description`) |
| `invalidMedicationOrder`  | A medication order failed required-field or catalog validation                        |
| `invalidPreferences`      | `setPersonalizationPreferences()` was called with nil or empty preferences            |

## Recording and microphone

These errors can occur while starting or resuming audio recording.

| Error id                            | Description                                                                |
| :---------------------------------- | :------------------------------------------------------------------------- |
| `micIsInUse`                        | Another app is using the microphone. Cannot start or resume recording      |
| `needMicrophonePermissionRecording` | Microphone permission has not been granted                                 |
| `appIsNotActive`                    | Recording cannot start while the app is in the background                  |
| `unableToStartRecording`            | Audio engine setup failed (no inputs, `AVAudioSession` error, and similar) |

## Content retrieval

These errors can occur while fetching transcripts, note suggestions, or structured data from the server.

| Error id                    | Description                                                         |
| :-------------------------- | :------------------------------------------------------------------ |
| `unableFetchTranscript`     | Failed to fetch the session transcript from the server              |
| `unableFetchContent`        | Failed to fetch generated note suggestions from the server          |
| `unableFetchStructuredData` | Failed to fetch structured data (diagnoses, orders) from the server |
