---
title: "Remove Asset"
description: "Documentation for Remove Asset Command in ZeyOS SDK CLI"
canonical_url: "https://www.zeyos.com/sdk/asset-management/zeysdk-remove"
markdown_url: "https://www.zeyos.com/ai/guide/sdk/asset-management/zeysdk-remove.md"
section: "sdk"
authority: "guide"
language: "en"
source_repository: "zeyos/sdk-v2"
source_path: "docs/asset-management/zeysdk-remove.md"
source_revision: "a99897af74253b4dc5af6fecb9301cea0ae18e27"
---

# Remove Asset

The `remove` command removes an existing asset from your ZeyOS application.

```bash
zeysdk remove <ASSET_PATH> [options]
```

**Parameters**

| Parameter | Description | Required | Example |
|-----------|-------------|----------| ------- |
| `ASSET_PATH` | Asset path including class directory and filename | Yes | `services/my-service.ixml` |

**Options**

| Option | Description |
|--------|-------------|
| `--verbose` | Show detailed output |

**Process**

1. **Validation**
   - Verifies `zeyos.app.json` exists
   - Validates the asset class from `ASSET_PATH`
   - Rejects traversal, absolute paths, symbolic-link path components, and invalid characters
   - Confirms the asset key exists and its extension matches the MIME type in the manifest

2. **Manifest Update**
   - Removes the asset entry from `zeyos.app.json`
   - Preserves unrelated asset definitions

3. **File Removal**
   - Deletes the local asset file
   - Removes empty parent directories below the asset-class directory
   - Treats an already-missing local file as a successful manifest cleanup
   - Reports progress when verbose output is enabled
   - Leaves remote deletion to `zeysdk push` or `zeysdk sync`

Generic `assets` may use nested paths. Services, resources, and weblets use a single filename below their class directory. The operation is serialized with other local manifest mutations, and a filesystem error restores the manifest entry.

**Error Handling**

| Error | Description | Resolution | Example |
|-------|-------------|------------|---------|
| Invalid asset class | Wrong type specified | Use correct class | `Invalid asset class. Expected: services, resources, weblets, assets` |
| Missing app.json | Config file not found | Initialize app | `requires the zeyos.app.json file to exist` |
| Asset not found | Asset doesn't exist | Check asset name | `requires the asset key to exist in zeyos.app.json` |
| Extension mismatch | Filename does not match the registered MIME type | Use the registered path | `requires the file extension to match` |
| Unsafe path | Path escapes its asset directory or contains a symbolic link | Use a path inside the app | `requires the asset file path to stay inside` |
| File delete error | Cannot remove file | Check permissions | `There was a problem deleting the file` |

**Notes**

- `remove` deletes the local file and its manifest entry
- The command does not prompt for confirmation
- The remote instance is not updated until you push or sync
- Removing an asset can affect services, weblets, or references that depend on it
- Use `zeysdk compare` to review removal before synchronizing

**Best Practices**

- Search for references before removing shared resources
- Create a snapshot before large cleanup work
- Remove unused manifest entries and files together
- Push removals during a planned maintenance window when users may be affected

**Examples**

```bash
# Remove a service
zeysdk remove services/backup.ixml --verbose
# Output:
# Loading assets info.
# Updating assets info.
# Deleting file: services/backup.ixml (...)
# File deleted successfully.
# Remove was completed successfully.

# Remove a weblet
zeysdk remove weblets/dashboard.ixml

# Remove a resource
zeysdk remove resources/logo.png

# Remove a nested generic asset
zeysdk remove assets/images/icons/favicon.ico
```
