---
title: NoRoom
description: A luna that reserves memory and cores could not open, because no machine had that much free.
related:
  - /sdk/define-luna
  - /platform/limits
  - /errors
---

`NoRoom` means a luna that reserves its memory and cores could not open, because no machine had that much free. The status is 503.

## Issue

A call to a luna of a reserving type fails after a wait. The body says what the luna reserves and when to try again.

```json
{"error": {"code": "NoRoom", "message": "<MESSAGE>", "reserve": {"memoryMib": 4096, "cpu": 2.0}, "retryAfterMs": 5000}}
```

## Cause

The luna type sets [`limits`](/sdk/define-luna) with `reserve: true`. Each luna of that type holds all of its memory and cores from when it opens until it closes.

```ts luna/lunas/room.ts
import { defineLuna, t } from "luna";

export const Room = defineLuna({
  name: "Room",
  key: { id: t.string() },
  limits: { memory: "4GB", cpu: 2, reserve: true },
  handlers: (h) => ({
    ping: h({}, () => "pong"),
  }),
});
```

Opening such a luna waits for a machine with that much unreserved. Luna asks again for a while before it answers `NoRoom`.

`NoRoom` differs from [`Unavailable`](/errors/unavailable) only in why the luna could not run. Neither call started, so both are safe to retry.

## Solution

Retry after `retryAfterMs`. The call never started, so it runs once when it does. A `LunaCallError` marks `NoRoom` as `retryable`.

- Reserve less, if the luna can do its work with less memory or fewer cores.
- Drop `reserve: true` to let the luna grow towards its `limits` as it needs, paying for what it uses.
- Let idle lunas of the type close sooner with a shorter `idleTimeout`, so they give back what they hold.
