> For the complete documentation index, see [llms.txt](https://docs.pharos.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pharos.ai/configuration-guide/the-basics/uninstall.md).

# Uninstall

Cleanly remove Pharos from your Salesforce org. Delete the Pharos email service first, then uninstall the managed package.

If you need to remove Pharos from a Salesforce org, the uninstall has **one prerequisite**: the Pharos email service must be deleted **before** you uninstall the managed package. Salesforce will block the package uninstall otherwise, because the email service holds a reference to a managed Apex class.

{% hint style="warning" %}
**Order matters.** Skipping or reversing these steps causes the standard Salesforce package uninstall to fail with a dependency error. Delete the email service first, then uninstall the package.
{% endhint %}

***

## Step 1: Delete the Pharos Email Service

The Pharos email service is named **ErrorEmailHandler**. It receives Apex exception emails and creates log records (see [Apex Exception Tracking](https://docs.pharos.ai/configuration-guide/error-tracking/apex-exception-tracking.md) for what it does in normal operation).

You delete it in two parts: first the **email address** the service listens on, then the **email service itself**.

{% stepper %}
{% step %}

### Open Email Services in Salesforce Setup

In Salesforce, click **Setup** (top-right gear → Setup). In the Quick Find box, type `Email Services` and click the **Email Services** result.
{% endstep %}

{% step %}

### Open the Pharos email service

In the Email Services list, click **Error Email Handler** (also displayed as `ErrorEmailHandler`).
{% endstep %}

{% step %}

### Delete the email address

On the Error Email Handler page, scroll to the **Email Addresses** section. Click **View** next to the Pharos email address (typically `erroremailhandler@...salesforce.com` or similar — the exact value is the address Apex exception emails are forwarded to).

On the address detail page, click **Delete**. When Salesforce prompts to confirm, click **OK**.
{% endstep %}

{% step %}

### Delete the email service itself

Salesforce returns you to the **Error Email Handler** page. Click **Delete** at the top of the page (this removes the email service, not just the address). Confirm with **OK**.

After this, the Email Services page no longer lists Error Email Handler. The Pharos email service has been fully removed and the package no longer has a reference holding it in place.
{% endstep %}
{% endstepper %}

{% hint style="info" %}
The email service is configured by the [Quick Start](https://docs.pharos.ai/configuration-guide/quick-start.md) wizard during initial setup. Removing it has no impact outside of Pharos — it is a Pharos-owned Apex class that lives only within the managed package.
{% endhint %}

***

## Step 2: Uninstall the Pharos Package

With the email service deleted, the standard Salesforce package uninstall completes cleanly.

{% stepper %}
{% step %}

### Open Installed Packages

In Salesforce Setup, type `Installed Packages` in the Quick Find box and click the **Installed Packages** result.
{% endstep %}

{% step %}

### Uninstall Pharos

In the list, find the Pharos package and click **Uninstall** in the action column.
{% endstep %}

{% step %}

### Choose what to do with package data

Salesforce asks whether to **save** or **delete** the data stored in Pharos custom objects (logs, issues, monitoring events, etc.) during uninstall:

| Option                                              | Result                                                                                       |
| --------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| **Save a copy of this package's data for 48 hours** | Salesforce exports the data and emails you a download link. The link expires after 48 hours. |
| **Do not save a copy of this package's data**       | Data is deleted immediately and is not recoverable.                                          |

Pick whichever is appropriate. If you might reinstall and want to preserve historical logs and issues, choose to save.
{% endstep %}

{% step %}

### Confirm and submit

Acknowledge the confirmation checkbox, then click **Uninstall**. Salesforce processes the uninstall asynchronously and emails you when it completes (typically within a few minutes).
{% endstep %}
{% endstepper %}

***

## After Uninstall

| Item                                                                  | Status                                                                                                                                                   |
| --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Pharos custom objects, fields, Apex classes, Lightning pages**      | Removed by Salesforce                                                                                                                                    |
| **Pharos managed package custom settings**                            | Removed by Salesforce                                                                                                                                    |
| **Apex Exception Email forwarding configured at user/org level**      | **Not** removed automatically — clean up in **Setup → Apex Exception Email** if no longer needed                                                         |
| **External integrations (Slack, Jira, Azure DevOps, GitHub, OpenAI)** | OAuth tokens are removed with the package, but the corresponding apps in the third-party systems remain. Revoke them on the third-party side if desired. |
| **Connected Apps Pharos created in Salesforce**                       | Salesforce removes these with the package.                                                                                                               |

***

## Troubleshooting

| Issue                                                            | Cause                                                               | Resolution                                                                                                                                                                                  |
| ---------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Uninstall fails: "component is referenced by..."                 | Email service still references a managed Apex class                 | Return to **Step 1** — the email address and the email service itself must both be deleted before uninstalling                                                                              |
| Uninstall fails: scheduled jobs still referencing Pharos classes | Pharos batch jobs (e.g., `LogServiceScheduler`) are still scheduled | In **Setup → Scheduled Jobs**, delete any Pharos jobs (they are owned by the [Pharos Running User](https://docs.pharos.ai/configuration-guide/the-basics/pharos-running-user.md)) and retry |
| Uninstall takes longer than expected                             | Large data volume in Pharos objects                                 | Salesforce processes the data export and deletion asynchronously; wait for the completion email rather than retrying                                                                        |
| Uninstall completed but data export email not received           | Salesforce email deliverability or recipient inbox issue            | Check your spam folder; the export link is valid for 48 hours from generation                                                                                                               |

***

## Reinstalling Later

If you uninstalled but kept the data export and want to reinstall:

1. Reinstall the Pharos package using the standard [Package Installation](https://docs.pharos.ai/configuration-guide/the-basics/package-installation.md) flow
2. Run the [Quick Start](https://docs.pharos.ai/configuration-guide/quick-start.md) wizard to reconfigure the email service, custom settings, and Pharos Running User
3. Import historical data from the saved export, if applicable (this is a manual data load — Pharos does not provide a re-import wizard)

***

## Related

* [Package Installation](https://docs.pharos.ai/configuration-guide/the-basics/package-installation.md) — The reverse direction
* [Apex Exception Tracking](https://docs.pharos.ai/configuration-guide/error-tracking/apex-exception-tracking.md) — What the email service does in normal operation
* [Pharos Running User](https://docs.pharos.ai/configuration-guide/the-basics/pharos-running-user.md) — The user that owned scheduled jobs and the email service context
