---
title: Lifecycle
description: "Analysis states, occupied slots, starting, stopping and deleting."
url: "https://mediaseer.ai/docs/lifecycle/"
---

# Lifecycle

An [analysis](https://mediaseer.ai/docs/glossary/#analysis) is the resource that tracks a video from upload through processing to its result. Finishing the upload leaves it `UPLOADING` until you call `start`.

| State | Meaning |
| - | - |
| `UPLOADING` | Created. Upload the file, then start it. |
| `QUEUED` | Started. The video’s length is checked, then it waits. |
| `PROCESSING` | The video is being analysed. |
| `FINISHED` | Results and playback are ready. |
| `FAILED` | The analysis could not start or finish. `error.message` says why. |
| `CANCELLED` | The analysis was stopped. |

`error.message` is Mediaseer’s own sentence, never the processing platform’s text. It names the cause when Mediaseer knows it, such as a video over the [length limit](https://mediaseer.ai/docs/limits/#file-size-and-video-length) or a start that never ran; otherwise it says only that the encoding failed or no longer exists. Don’t branch on its wording.

While an analysis is `QUEUED`, Mediaseer reads the whole video to measure its length before it is processed. A video longer than the length limit ends `FAILED` then, and its start doesn’t count. The length measured then is final: it is the one counted in the period’s analysed minutes once the analysis finishes.

Ask for the analysis until its state is final: `FINISHED`, `FAILED` or `CANCELLED`. An analysis can reach a final state without you observing `PROCESSING`. The [wait guide](https://mediaseer.ai/docs/guides/wait/) shows how.

## Slots

Creating an analysis takes an [analysis slot](https://mediaseer.ai/docs/limits/#analysis-slots).

- `UPLOADING` holds its slot until the [upload window](https://mediaseer.ai/docs/limits/#how-long-links-last) expires. After that it cannot be started and stays in your list until deleted.
- `QUEUED`, `PROCESSING` and `FINISHED` hold a slot until deleted.
- `FAILED` and `CANCELLED` free their slot and remain in the list until deleted.

## Starting

Starting a `QUEUED` or `PROCESSING` analysis again returns it without starting another run. The [limits page](https://mediaseer.ai/docs/limits/#when-create-and-start-refuse) lists create and start refusals.

Retrying a start after `502` `UPSTREAM_ERROR` is safe. After an uncertain answer, check the analysis’s state. A start confirmed not to have run no longer counts against your starts for that day.

## Stop and delete

- Stop an `UPLOADING` analysis to remove it from your account and free its slot.
- Stop a `QUEUED` or `PROCESSING` analysis to mark it `CANCELLED` and free its slot. Processing may still be stopping after the response. The start still counts against your daily starts.
- Stopping a final analysis returns `409` `INVALID_STATE`.

Delete works in any state and removes the analysis from your account. File and processing-record cleanup is described on the [data page](https://mediaseer.ai/docs/data/).

If deletion returns `502`, retrying is safe. An in-progress analysis then stays `CANCELLED`; other analyses keep their state.

## Clip jobs

A clip job cuts the video of a `FINISHED` analysis into clips. Creating one answers right away with the job in `SUBMITTING`. It becomes `PROCESSING` once its clips are being made, or `FAILED`, with the reason in `error`, when it could not be started.

The clips of a `READY` job can be edited in the web app, while the job’s `editable` is `true`. Once an edit has finished, the clip’s `editedAt` says when, and `getClipEpisodeMedia` with `version=EDITED` returns the URLs of its newest edit; without `version` it returns the clip as it was made.

Deleting a clip job works in any state and removes the job and its clips from your account at once. A job whose clips are still being made is stopped, also one deleted while `SUBMITTING`. Deleting an analysis deletes its clip jobs too. Cleanup at the clip service is described on the [data page](https://mediaseer.ai/docs/data/#clips).
