# Deviations

## What is a Deviation?

A **deviation** occurs when at least one resource of a service does not reach its **target state** after the service is enabled. When you [enable a service](https://docs.cybus.io/2-0-6/documentation/services/setting-up-and-configuring-services/enabling-services), its resources are expected to transition from disabled to enabled (or to another state defined in the service commissioning file). The service commissioning file specifies all resources and the states they must reach for the service to function correctly.

If issues such as hardware faults, network outages, or misconfiguration prevent resources from reaching those states, the service is marked as **deviated**. A single out-of-state resource is enough for the entire service to be considered deviated.

## Where to See Deviations in the Admin UI

You can find services whose actual states differ from their expected states in several places:

* **Deviations notification:** When a deviation occurs, a pop-up appears in the Admin UI. Click the down arrow to expand the panel and see all currently deviated services.

<figure><img src="https://639096190-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfDpOJO2upcq5EpoSahvK%2Fuploads%2Fgit-blob-51f9ba64bccbceaaa8ee354096a32cc951fa15c9%2Fdeviation-popup.png?alt=media" alt="Deviation notification popup"><figcaption><p>Deviation notification</p></figcaption></figure>

<figure><img src="https://639096190-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfDpOJO2upcq5EpoSahvK%2Fuploads%2Fgit-blob-a87d443d7c956a72a7a26b7c6b2b09118ef91155%2Fdeviation-details.png?alt=media" alt="Detailed view of deviated resources"><figcaption><p>Expanded Deviation notification showing state discrepancies</p></figcaption></figure>

* **Deviated Services view:** Go to **Services** → **Deviated Services** for a consolidated list of all deviated services. The overview shows **Service ID**, **Name**, **Version**, and the number of **Deviated Resources** per service.
* **Deviations tabs across the Admin UI:** Deviation status and details are also available in:
  * The [Service Overview](https://docs.cybus.io/2-0-6/documentation/services/service-overview).
  * The [Service Details view](https://docs.cybus.io/2-0-6/documentation/services/service-details-view) for individual services.
  * The [Resources](https://docs.cybus.io/2-0-6/documentation/services/service-resources-view) lists of an affected service.

## Inspecting Deviated Resources

To see exactly which resources are causing a deviation:

1. Open any of the [locations](#where-to-see-deviations-in-the-admin-ui) above where deviations are shown.
2. Review the comparison between expected and actual states for each resource

<figure><img src="https://639096190-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfDpOJO2upcq5EpoSahvK%2Fuploads%2Fgit-blob-8c9bd4c4ee83d4112a1406263f5160e967dd677e%2Fdeviation-tab.png?alt=media" alt="Deviations tab showing resource status"><figcaption><p>Deviations tab displaying expected vs. actual status for each deviated resource</p></figcaption></figure>

## Resolving Deviations

When addressing deviations, working through the following checklist is a good practice:

1. **Identify the root cause**
   * **Hardware:** Device powered on? Correct port/cabling? Any faults or alarms?
   * **Network:** Reachability, DNS, routing, firewall rules, required ports open.
   * **Configuration:** Credentials, certificates/keys, endpoints, topics/paths, resource parameters match the service commissioning file.
   * **Dependencies:** Upstream resources healthy (connections, adapters, brokers, PLCs, etc.).
2. **Fix the underlying issue**
   * Update configuration values that are wrong or outdated.
   * Restore connectivity or replace faulty hardware.
   * Correct dependency order or bring prerequisites online first.
3. **Verify and re-enable**
   * Re-enable the service to trigger the state transition. See [Enabling Services](https://docs.cybus.io/2-0-6/documentation/services/setting-up-and-configuring-services/enabling-services).
   * Confirm all resources reach their target state and that the deviation indicator clears.

{% hint style="info" %}
If a deviation persists after remediation, capture details (affected resources, error messages, recent changes) and escalate to your system administrator for further troubleshooting.
{% endhint %}
