> ## 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.

# Medication Orders Error Codes

> Learn how to handle errors and exceptions during Medication orders generation in the Headed Web SDK

<div className="quick-summary-wrapper">
  <div className="quick-summary-header">
    <span className="quick-summary-icon" aria-hidden="true" />

    <span className="quick-summary-title">Quick summary</span>
  </div>

  <div className="quick-summary-content">
    Medication orders use <code>ORD\_SDK\_\*</code> error codes when generation fails or when one or more orders are missing required fields. Listen for Web SDK <code>error</code> events and inspect <code>error.code</code> to handle errors during Medication orders generation effectively.
  </div>

  <div className="quick-summary-footer">
    <span className="quick-summary-footer-icon" aria-hidden="true" />

    <span className="quick-summary-footer-text">Last updated:</span>
    <span className="quick-summary-footer-date">June 2026</span>
  </div>
</div>

The Headed Web SDK uses **`ORD_SDK_*`** error codes to identify errors during Medication orders generation.
This guide lists each code, its name, and when it applies so you can handle errors during Medication orders generation effectively.

## Medication orders error codes

The table below is the reference for Medication orders error codes, names, and descriptions.

| Code              | Name                       | When it occurs                                                                 | Suggested action                                            |
| :---------------- | :------------------------- | :----------------------------------------------------------------------------- | :---------------------------------------------------------- |
| **`ORD_SDK_001`** | `ORDERS_GENERATION_FAILED` | Occurs when the Web SDK fails to generate medication orders for the session.   | Review the error details and retry the order generation.    |
| **`ORD_SDK_003`** | `INCOMPLETE_ORDER`         | Occurs when one or more orders are missing required fields (RxCUI, diagnosis). | Complete the missing fields and retry the order generation. |

## Handling Medication orders errors

Subscribe to the `error` event on `SukiClient` (JavaScript) or through the `useSuki()` hook (React). Check `error.code` for `ORD_SDK_*` values. For how to subscribe to SDK errors, refer to [Error handling](/web-sdk/guides/error-handling#listening-for-errors).

<View title="JavaScript" icon="js">
  ```js JavaScript theme={"theme":{"light":"github-dark","dark":"material-theme-darker"}}
  const unsubscribeError = sdkClient.on("error", (error) => {
    switch (error.code) {
      case "ORD_SDK_001":
        console.error("Order generation failed for the session:", error);
        break;
      case "ORD_SDK_003":
        console.error("Incomplete medication order:", error);
        break;
      default:
        break;
    }
  });
  ```
</View>

<View title="React" icon="react">
  ```jsx React theme={"theme":{"light":"github-dark","dark":"material-theme-darker"}}
  import { useSuki } from "@suki-sdk/react";
  import { useEffect } from "react";

  const { on } = useSuki();

  useEffect(() => {
    const unsubscribe = on("error", (error) => {
      switch (error.code) {
        case "ORD_SDK_001":
          console.error("Order generation failed for the session:", error);
          break;
        case "ORD_SDK_003":
          console.error("Incomplete medication order:", error);
          break;
        default:
          break;
      }
    });

    return () => unsubscribe();
  }, [on]);
  ```
</View>

## Next steps

<Icon icon="file-lines" iconType="solid" /> [Medication orders overview](/web-sdk/medication-orders/overview)

<Icon icon="file-lines" iconType="solid" /> [Medication orders payload structure](/web-sdk/medication-orders/payload-structure)
