# 14 Service Unavailable

**Category**: `service_unavailable`
**GTS ID**: `gts.cf.core.errors.err.v1~cf.core.err.service_unavailable.v1~`
**HTTP Status**: 503
**Title**: "Service Unavailable"
**Use When**: The service is temporarily unavailable (maintenance, overload, dependency down). System-level only — not generated by the `#[resource_error]` macro.
**Similar Categories**: `resource_exhausted` — per-caller quota vs system-wide unavailability
**Resource-scoped error**: no
**Default Message**: "Service temporarily unavailable"

## Context Schema

| Field | Type | Description |
|-------|------|-------------|
| `retry_after_seconds` | `u64` | Minimum seconds to wait before retrying |
| `extra` | `Option<Object>` | Reserved for derived GTS type extensions (p3+); absent in p1 |

## Constructor Example

```rust
use cf_toolkit_errors::CanonicalError;

let err = CanonicalError::service_unavailable()
    .with_retry_after_seconds(30)
    .create();
```

## JSON Wire — JSON Schema

```json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "gts://gts.cf.core.errors.err.v1~cf.core.err.service_unavailable.v1~",
  "type": "object",
  "allOf": [
    { "$ref": "gts://gts.cf.core.errors.err.v1~" },
    {
      "properties": {
        "type": {
          "const": "gts://gts.cf.core.errors.err.v1~cf.core.err.service_unavailable.v1~"
        },
        "title": { "const": "Service Unavailable" },
        "status": { "const": 503 },
        "context": {
          "type": "object",
          "required": ["retry_after_seconds"],
          "properties": {
            "retry_after_seconds": {
              "type": "integer",
              "minimum": 0,
              "description": "Minimum seconds to wait before retrying"
            },
            "extra": {
              "type": ["object", "null"],
              "description": "Reserved for derived GTS type extensions (p3+); absent in p1"
            }
          },
          "additionalProperties": false
        }
      }
    }
  ]
}
```

## JSON Wire — JSON Example

```json
{
  "type": "gts://gts.cf.core.errors.err.v1~cf.core.err.service_unavailable.v1~",
  "title": "Service Unavailable",
  "status": 503,
  "detail": "Service temporarily unavailable",
  "context": {
    "retry_after_seconds": 30
  }
}
```
