ruvnet/RuView · error · HTTPException

Zone '{zone_id}' not found

Error message

Zone '{zone_id}' not found

What it means

validate_zone_access raises 404 "Zone '<zone_id>' not found" when domain_config.get_zone(zone_id) returns None — the id is not present in the loaded domain configuration. This runs before any user-level access checks, so it fires for authenticated and anonymous callers alike.

Source

Thrown at archive/v1/src/api/dependencies.py:183

            )
        
        return current_user
    
    return check_permission


# Zone access dependencies
async def validate_zone_access(
    zone_id: str,
    current_user: Optional[Dict[str, Any]] = Depends(get_current_user)
) -> str:
    """Validate user access to a specific zone."""
    domain_config = get_domain_config()
    
    # Check if zone exists
    zone = domain_config.get_zone(zone_id)
    if not zone:
        raise HTTPException(
            status_code=status.HTTP_404_NOT_FOUND,
            detail=f"Zone '{zone_id}' not found"
        )
    
    # Check if zone is enabled
    if not zone.enabled:
        raise HTTPException(
            status_code=status.HTTP_403_FORBIDDEN,
            detail=f"Zone '{zone_id}' is disabled"
        )
    
    # If authentication is enabled, check user access
    if current_user:
        # Admin users have access to all zones
        if current_user.get("is_admin", False):
            return zone_id
        
        # Check user's zone permissions

View on GitHub (pinned to 4685618388)

Solutions

  1. List the valid zones (via the zones API or the domain config file) and use an exact id
  2. Verify get_domain_config() actually loaded the expected file and the zone entry exists
  3. Fix typos or letter-case differences in the zone id
Defensive patterns

Strategy: validation

Validate before calling

# Discover valid ids before calling zone-scoped routes
zones = client.get('/api/zones', headers=auth).json()
valid_ids = {z['id'] for z in zones}
if zone_id not in valid_ids:
    raise ValueError(f'Unknown zone {zone_id!r}; valid: {sorted(valid_ids)}')
client.get(f'/api/zones/{zone_id}/pose', headers=auth)

Try / catch

try:
    r = client.get(f'/api/zones/{zone_id}/pose', headers=auth)
    r.raise_for_status()
except httpx.HTTPStatusError as e:
    if e.response.status_code == 404:
        refresh_zone_list()  # ids drift when server config changes
    raise

Prevention

When it happens

Trigger: A path parameter zone_id that does not match any configured zone (typo, case mismatch); the zones/domain config file not loaded or empty; requesting a zone that was removed from configuration.

Common situations: Client caching old zone ids after a server config change; DOMAIN/ZONES config env var pointing at the wrong file; fresh deployment missing the domain configuration.

Related errors


AI-assisted analysis of ruvnet/RuView@4685618388 (2026-08-16). Data as JSON: /api/errors/0674b9a0820cba47. Report an issue: GitHub.