﻿# MODEL_ALREADY_LOCKED — model is already in the LOCKED state

Returned by any admin operation that requires the model be in the `UNLOCKED` state, including:

<em>cyoda-go version <a href="https://github.com/Cyoda-platform/cyoda-go/releases/tag/v0.7.1">0.7.1</a></em>

# errors.MODEL_ALREADY_LOCKED

## NAME

MODEL_ALREADY_LOCKED — an admin operation requested the model be in the `UNLOCKED` state, but the model is already `LOCKED`.

## SYNOPSIS

HTTP: `409` `Conflict`. Retryable: `no`.

## DESCRIPTION

Returned by any admin operation that requires the model be in the `UNLOCKED` state, including:

- `POST /model/{name}/{version}/lock` — the relock is rejected because the model is already locked.
- Re-importing a model whose existing descriptor is already `LOCKED`.

The problem-detail body carries `entityName` and `entityVersion` on every emit; the relock branch additionally sets `expectedState` (always `UNLOCKED`) and `actualState` (always `LOCKED`) so callers can branch on the precondition without scraping the message string.

Not retryable. To proceed, either accept the existing lock or unlock the model first via `POST /model/{name}/{version}/unlock`.

## SEE ALSO

- errors
- errors.MODEL_NOT_FOUND
- errors.MODEL_NOT_LOCKED
- errors.CONFLICT

## See also

- [`cyoda help errors`](/help/errors/) — Every error response from the Cyoda REST API carries a structured `errorCode` in the `properties` object. Multiple codes may share the same HTTP status. Programmatic handling keys on `errorCode`, not HTTP status.
- [`cyoda help errors MODEL_NOT_FOUND`](/help/errors/model_not_found/) — The entity type or model name specified in the request does not exist in the tenant's model registry. Occurs when creating entities with an unknown type, importing data that references a missing model, or performing model lifecycle transitions on a model ID that does not exist.
- [`cyoda help errors MODEL_NOT_LOCKED`](/help/errors/model_not_locked/) — Entity creation and bulk write operations require the model to be in the `LOCKED` lifecycle state. Models in `DRAFT` or unlocked-for-editing state reject writes to prevent schema changes from affecting in-flight data.
- [`cyoda help errors CONFLICT`](/help/errors/conflict/) — The server detected that the entity was modified by another writer between the time it was read and the time the current write was committed. Normal outcome under concurrent load.

## Raw formats

- [`/help/errors/model_already_locked.json`](/help/errors/model_already_locked.json) — full descriptor (matches `GET /help/{topic}` envelope)
- [`/help/errors/model_already_locked.md`](/help/errors/model_already_locked.md) — body only