> ## Documentation Index
> Fetch the complete documentation index at: https://developer.upsun.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancel an activity

> See how to cancel running or pending activities in an environment.

export const VariableBlock = ({name}) => {
  return <var spellCheck={false} title={`Replace '${name}' with your own data`}>{name}</var>;
};

export const MoreIcon = () => <svg width="24px" height="24px" style={{
  display: 'inline',
  verticalAlign: 'middle'
}}>
    <title id="more-icon">More</title>
    <path d="M12 6.5C12.8284 6.5 13.5 5.82843 13.5 5C13.5 4.17157 12.8284 3.5 12 3.5C11.1716 3.5 10.5 4.17157 10.5 5C10.5 5.82843 11.1716 6.5 12 6.5Z" fill="current"></path>
    <path d="M12 13.5C12.8284 13.5 13.5 12.8284 13.5 12C13.5 11.1716 12.8284 10.5 12 10.5C11.1716 10.5 10.5 11.1716 10.5 12C10.5 12.8284 11.1716 13.5 12 13.5Z" fill="current"></path>
    <path d="M12 20.5C12.8284 20.5 13.5 19.8284 13.5 19C13.5 18.1716 12.8284 17.5 12 17.5C11.1716 17.5 10.5 18.1716 10.5 19C10.5 19.8284 11.1716 20.5 12 20.5Z" fill="current"></path>
  </svg>;

If you have a stuck activity or you pushed a change you know doesn't work,
you can cancel a running or pending activity on an environment.
This works for activities such as builds, cron jobs, and source operations.

You can cancel activities using the [CLI](/cli)
or in the [Console](/docs/administration/web).

<Tabs>
  <Tab title="Using the CLI">
    Run the following command:

    ```bash theme={null}
    upsun activity:cancel
    ```

    If you have more than one running or pending activity, choose which activity to cancel.

    You can also cancel a specific activity by specifying its ID:

    ```bash theme={null}
    upsun activity:cancel <ACTIVITY_ID>
    ```

    Get the ID from the [activity log](/docs/observability/logs/access-logs#activity-logs).
  </Tab>

  <Tab title="In the Console">
    1. Open the environment where you want to cancel an activity.
    2. In the [activity log](/docs/observability/logs/access-logs#activity-logs),
       click <MoreIcon /> **More** next to the activity you want to cancel.
    3. Click **Cancel**.
  </Tab>
</Tabs>

## Non-cancellable activities

An activity can finish in between when you load the Console and when you click **Cancel**.
For example, when the activity is a [source operation](/docs/configure-apps/source-operations)
and the related build hook has already completed.
In such cases, you get a message that the activity can't be cancelled.
