# Exit Codes for Apps, Scripts, and Drivers

> Look up what an exit or error code from a Company App, script, Repository App, or driver installation means, which status it gives in CapaOne, and what to do next.

Source: https://docs.capaone.com/capaone/reference/exit-codes-for-apps-scripts-and-drivers/  
Product: CapaOne — a separate CapaSystems product; do not apply this page to any other.

When the CapaOne Agent installs a Company App, script, Repository App, or driver pack, the result
has an exit code. This page lists the codes, the status each one gives in CapaOne, and what to do.

The code is in the logs for the job. `PackageInstaller.log` shows it in the **Statistics** summary,
for example `ErrorCode: PACKAGE_FAILED_INSTALL (3329)`. `Install.log` shows the final code of the
script as `SCRIPT ENDED WITH EXITCODE: <code>`. See
[Read Installation Logs for Company Apps and Scripts](/capaone/troubleshooting/read-installation-logs-for-company-apps-and-scripts/).

## Success codes

| Code | Name | Status |
|---|---|---|
| `0` | `SUCCESS` | **Installed** |
| `3010` | `SUCCESS_REBOOT_REQUIRED` | **Installed**. A restart is needed to finish the installation. |
| `3011` | `SUCCESS_RESTART_REQUIRED` | **Installed**. A restart is needed. |
| `3300` | `COMMAND_SUCCEDED` | **Installed** |

## Agent codes for apps and scripts

| Code | Name | What it means | Status | What to do |
|---|---|---|---|---|
| `3304` | `COMMAND_TIMED_OUT` | The installation didn't finish within the time limit and was stopped. | **Failed** | In `Install.log`, find the brick that started but didn't end. Check whether its installer waits for input. |
| `3310` | `ERROR_NO_RESULT` | `No exitcode set`. The script ended without reporting an exit code. | **Failed Install** | See [3310: No exitcode set](#3310-no-exitcode-set). |
| `3321` | `PACKAGE_DOWNLOAD_OUT_OF_RETRIES` | `Download failed after <n> retries`. The download of the app's files gave up. | **Cancelled (retry later)** | Nothing. CapaOne tries again. Check that the endpoint can reach CapaOne. |
| `3322` | `PACKAGE_DOWNLOAD_FAILED` | **Download Content** failed. | **Cancelled (retry later)** or **Failed Install** | See [Download Content always reports 3322](#download-content-always-reports-3322). |
| `3323` | `PACKAGE_DOWNLOAD_UNPACKING_FAILED` | The files were downloaded but couldn't be unpacked. | **Failed Install** | Delete the app, upload its files again, and assign it again. |
| `3324` | `PACKAGE_DOWNLOAD_INITIALIZATION_FAILED` | The download couldn't start. | **Failed Install** | Redeploy. Check that the endpoint can reach CapaOne. |
| `3325` | `PACKAGE_DOWNLOAD_TRANSFER_FAILED` | The file transfer failed. | **Failed Install** | Redeploy. Check that the endpoint can reach CapaOne. |
| `3326` | `PACKAGE_CANCELLED_RETRY_LATER` | The agent or the package stopped the installation, to run it again later. | **Cancelled (retry later)** | Nothing. See [Cancelled (retry later) isn't a failure](/capaone/troubleshooting/application-update-stays-failed/#cancelled-retry-later-isnt-a-failure). |
| `3327` | `PACKAGE_CANCELLED_NOT_COMPLIANT` | The endpoint doesn't meet the package's requirements. | **Cancelled Not Compliant** | Check whether the app is meant for this endpoint. |
| `3328` | `PACKAGE_CANCELLED` | The package was cancelled. | **Cancelled** | Redeploy if the app is still needed. |
| `3329` | `PACKAGE_FAILED_INSTALL` | `The package <name> failed`. The installation failed. This is the default code when no other code fits. | **Failed Install** | Find the cause in `Install.log`. The installer's own exit code is often in the message, for example `(ExitCode: 17006)`. |
| `3330` | `PACKAGE_ALREADY_INSTALLED` | The same or a newer version is already installed. | **Installed Already** | Nothing. |
| `3331` | `PACKAGE_DOWNLOAD_MD5_MISMATCH` | The downloaded file had the wrong MD5 checksum twice in a row. | **Failed Install** | Redeploy. If it fails again, delete the app and upload its files again. |
| `3332` | `PACKAGE_FAILED_UNINSTALL` | The uninstallation failed. | **Failed Uninstall** | Find the cause in `Install.log` for the uninstall job. |
| `3333` | `PACKAGE_CANCELLED_OUT_OF_DISK_SPACE` | The endpoint doesn't have enough free disk space. | **Failed**, with the reason out of disk space | Free disk space on the endpoint, then redeploy. See [Windows Agent Requirements](/capaone/enrollment/windows-agent-requirements/#hardware-requirements). |

### Download Content always reports 3322

When the **Download Content** brick fails, it always ends with `3322`. It writes the real code
only as text in the log:

```text
Download failed: <code> <message>
```

The agent then decides the result from the real code:

- If the real code is `3321` or `3322`, the result is **Cancelled (retry later)**, and CapaOne
  tries again.
- If the real code is `3323` (unpacking failed) or `3331` (MD5 mismatch), the result is **Failed
  Install**. CapaOne still shows `3322`. The real code is only in the log.

### 3310: No exitcode set

The script reports its exit code with `Exit-PSScript`, which the generated script runs at the end.
If the script ends before that, no exit code is reported, and the job fails with `3310`.

The most common cause is `exit` in an **Execute PowerShell Snippet** brick. `exit` or `exit 0`
ends the whole script before it reaches `Exit-PSScript`. Don't use `exit` in a snippet. Let the
snippet end normally, or end it with `Exit-PSScript <code>`.

## Agent codes for driver packs

Driver pack installations have their own codes in the `34xx` range, with the same structure as the
codes for apps and scripts. For example:

| Code | What it means |
|---|---|
| `3422` | The download of the driver pack failed. |
| `3426` | Cancelled, to try again later. |
| `3429` | The driver installation failed. |
| `3432`, `3433` | Cancelled by the user, or timed out. |
| `3437` | Postponed. |

## Installer exit codes

These codes come from Windows or from the installer, not from CapaOne. The install brick compares
the installer's exit code with its **Return Code Handles**.

| Code | What it means | What to do |
|---|---|---|
| `1603` | A general installation error. PowerBricks also use it when a brick fails, as in `SCRIPT ENDED WITH EXITCODE: 1603`. | Find the first brick that failed in `Install.log`. See [Configure BitLocker Fails with Exit Code 1603](/capaone/troubleshooting/configure-bitlocker-fails-with-exit-code-1603/) and [Configure Power Settings Doesn't Apply the Power Plan](/capaone/troubleshooting/power-plan-import-fails-with-exit-code-1603/). |
| `1605` | The product isn't installed. | In the uninstall bricks, this counts as success by default. |
| `1618` | Another installation is already running. | In the MSI bricks, this gives retry later by default. |
| `1641` | The installer started a restart. | In **Install Driver**, this counts as success by default. |
| `17006` | Office applications were open and blocked the Microsoft 365 installation. | See [Install Microsoft 365 Fails with Exit Code 17006](/capaone/troubleshooting/install-microsoft-365-fails-with-exit-code-17006/). |
| `60012` | The PSAppDeployToolkit package asked to be run later. | In **Execute PSAppDeployToolkit Package**, this gives retry later by default. |
| `-2146233087` | `0x80131501`, the general code for an unhandled error in a script or brick. `Install.log` shows `Something bad happened at line …`. | Open `Install.log`, and check the script line it names. |

### Return Code Handles defaults

In every brick with **Return Code Handles**, `0` and `3010` count as success. Any code that isn't in
the list stops the job as failed, with `3329`. Some bricks have more defaults:

| Brick | More defaults |
|---|---|
| **Install MSI** | `1618`: **Retry Execution Later** |
| **Uninstall MSI**, **Uninstall Program** | `1605`: **Success**. `1618`: **Retry Execution Later** |
| **Install Driver** | `1641`: **Success** |
| **Execute PSAppDeployToolkit Package** | `60012`: **Retry Execution Later** |
| **Install EXE**, **Uninstall EXE**, **Execute Process**, **Install Microsoft 365** | None |

To handle another code, add it to **Return Code Handles** in the brick and choose **Success**,
**Failure**, or **Retry Execution Later**.

## Other codes you may see

| Code | What it means | What to do |
|---|---|---|
| `1053` | A Windows service error: the CapaOne Agent service didn't start in time. | See [CapaOne Agent Installation](/capaone/troubleshooting/capaone-agent-installation/#the-agent-service-doesnt-start-after-a-new-install-or-update). |

## Related

- [Read Installation Logs for Company Apps and Scripts](/capaone/troubleshooting/read-installation-logs-for-company-apps-and-scripts/)
- [Application Update Stays Failed](/capaone/troubleshooting/application-update-stays-failed/)
- [Company App and Script Problems](/capaone/troubleshooting/company-app-and-script-problems/)
- [Dynamic Parameter Values](/capaone/application-manager/powerbricks/dynamic-parameter-values/)
