# Compute administration lifecycle errors and recovery

| Operation/stage | Current behavior |
| --- | --- |
| Runtime query | A missing resource returns 404/NOT_FOUND; an existing resource without Worker records returns runtimes:[]. Common shared errors include ErrForbidden, ErrServiceUnavailable, and ErrServer. |
| Three lifecycle operations | State conflicts return 409/CANNOT_RESUME, CANNOT_RETRY, or CANNOT_SUSPEND; resume/retry CAS contention returns 409/LIFECYCLE_CONFLICT. |
| Lease/Cloud teardown | A classified error returns 409/RESOURCE_BUSY. Check the original operation and recovery records first; this response does not permit unlimited retries. |
| Not found/runtime unconfigured/unknown failure | These return 404, 503, and 500 respectively, with RESUME_ADMIN_FAILED, RETRY_ADMIN_FAILED, or SUSPEND_ADMIN_FAILED as the code. They do not all use NOT_FOUND. |

## Resume and retry

These require SUSPENDED and ERROR respectively. The transaction uses CAS against the expected previous state, resets the parent instance to IDLE, clears the status text, lifecycle token, and next idle time, and zeroes replica fields. Within the same transaction, only ACTIVE, SCALING, and DRAINING Worker records are reset to IDLE with zero replicas; this does not imply that every other record is rewritten. The instance is then read separately. That read may fail after the write commits, and concurrent operations may change the state that is read back.

Neither operation waits for Workers to become ready or directly starts Pods. A parent IDLE state or successful operation does not establish that tasks requiring all Workers can run. Verify per-type runtimes and actual scheduling. There is no client-supplied expected_version, idempotency key, or dedicated rollback request. Do not blindly resend after an error.

## Suspend

The administration entry point first resolves the target Workspace. The internal service then checks runtime service registration and the ACTIVE prerequisite. The runtime component acquires a suspension lease, records the usage interval, stops Workers, sets Worker records to IDLE, and uses the lease to persist SUSPENDED. Stopping, persisting Worker records, and the final CAS/read-back can each fail. An overall transactional rollback is not guaranteed; Cloud teardown may retain a DRAINING recovery marker.

The operator must check the original instance, lease/recovery records, per-type Worker states, and actual Provider. Partial stopping does not mean nothing happened. Do not create a replacement instance in place of recovering the original.

## Field compatibility and environments

A successful lifecycle HTTP response may echo saved, nonempty dependency fields that current typed models omit. A decoding error is a client error and does not mean the server rejected the operation. Retain the raw HTTP result and query the state again. Track SDK corrections separately from missing documentation; do not change the public protocol to work around model omissions.
