# Company App and Script Problems

> Fix a Company App or script whose upload stops at the same percentage, whose shortcut file uploads as the wrong file, that stays in Sending because of its name, or that fails with Missing bricks.

Source: https://docs.capaone.com/capaone/troubleshooting/company-app-and-script-problems/  
Product: CapaOne — a separate CapaSystems product; do not apply this page to any other.

## The upload progress stops and doesn't move

### Problem

When you create a Company App, the upload progress stops at the same percentage, for example 20%,
and doesn't move. This happens for any file. The app may still be created in the list, and opening
it can start the upload progress again.

### Cause

The browser session holds an old state of the upload display. The upload itself isn't the problem.

### Solution

1. Reload the page without the cache: press `Ctrl+Shift+R`.
2. If the progress still doesn't move, close all browser windows, open the browser, and sign in to
   CapaOne again.
3. Check whether the app is in the list on the **Company Apps** tab. If it isn't, upload it again.

The upload progress shows the real state of the upload.

## A shortcut file uploads as the wrong file or fails

### Problem

You add a shortcut (`.lnk` file) to a Company App with **Modify Content** under **Source Files**.
One of these happens:

- On a computer where the shortcut's target isn't installed, the upload fails with an error.
- On a computer where the target is installed, the target file, for example an `.exe` file, is
  added instead of the shortcut.

### Cause

Windows replaces a shortcut with its target before the browser gets the file. The browser uploads
the target, or fails if the target doesn't exist. CapaOne can't change this.

### Solution

Use one of these options:

- **Create the shortcut on the endpoint:** add the
  [Create Shortcut](/capaone/application-manager/powerbricks/bricks/create-shortcut/) PowerBrick to
  the app. In the brick, you set the target, arguments, icon, and working directory.
- **Upload the shortcut in a folder or ZIP file:** put the shortcut in a folder with the other
  files, and upload the folder or a `.zip` file of it. Windows doesn't replace shortcuts inside a
  folder or ZIP file.

## A script or app stays in Sending and creates no logs

### Problem

A script or Company App stays in the status **Sending** on an endpoint, for example for more than
20 minutes. Restarting the agent and redeploying don't help, and **View logs** shows no logs for
the job. CapaOne doesn't show an error.

### Cause

The name of the script or app contains a character that isn't allowed in Windows file names, for
example `|`. The agent creates a log folder named after the script or app, so the job fails on the
endpoint before it starts.

These characters aren't allowed in Windows file names:

```text
\ / : * ? " < > |
```

CapaOne rejects some of them when you save the name, but not all of them.

### Solution

1. Go to **Windows → Applications**, and open the script or app.
2. Select **Edit**, and change the **Name** so it doesn't contain any of the characters above. For
   example, change `SW | OpenProject` to `SW - OpenProject`.
3. Save the changes.
4. Open the **Endpoints** tab, and select **Redeploy** in the endpoint's row menu.

The job goes past **Sending**, and logs are created for it.

## A script or app fails with Missing bricks

### Problem

A script or Company App fails on the endpoint. The log shows:

```text
Failed Missing bricks
SCRIPT ENDED WITH EXITCODE: 3329
```

### Cause

The **Install** sequence in the PowerBricks Editor is empty. When you assign a script or app to an
endpoint, CapaOne runs the bricks in the **Install** sequence. The **Uninstall** sequence runs only
when the script or app is uninstalled from the endpoint.

This also applies to a script whose purpose is to remove software, for example a script that
uninstalls an application with an **Execute PowerShell Snippet** brick. Its bricks belong in the
**Install** sequence.

### Solution

1. Go to **Windows → Applications** and open the script or app.
2. Select **Edit**, and open the PowerBricks Editor.
3. Move the bricks from the **Uninstall** sequence to the **Install** sequence.
4. Save the changes.
5. Open the **Endpoints** tab, and select **Redeploy** in the endpoint's row menu.

The script or app runs its bricks on the endpoint.

If you use an **Execute PowerShell Snippet** brick, don't end the snippet with `exit <code>`. Use
`Exit-PSScript <code>` instead. See
[3310: No exitcode set](/capaone/reference/exit-codes-for-apps-scripts-and-drivers/#3310-no-exitcode-set).

## Related

- [Create a Company App](/capaone/application-manager/create-a-company-app/)
- [Create a Script](/capaone/application-manager/create-a-script/)
- [Script or Company App Install Fails Because a File Is Missing](/capaone/troubleshooting/script-or-company-app-install-fails-because-a-file-is-missing/)
- [Read Installation Logs for Company Apps and Scripts](/capaone/troubleshooting/read-installation-logs-for-company-apps-and-scripts/)
