ruvnet/RuView · warning · HTTPException
Zone '{zone_id}' not found
Error message
Zone '{zone_id}' not found What it means
HTTP 404 from GET /pose/zones/{zone_id}/occupancy when pose_service.get_zone_occupancy returns None for that zone id. None means the zone has no occupancy record at all (unknown or not-yet-seen), as opposed to a known zone with zero persons. The zone_id comes straight from the path with no format validation — matching is exact.
Source
Thrown at archive/v1/src/api/routers/pose.py:192
logger.error(f"Error in pose analysis: {e}")
raise HTTPException(
status_code=500,
detail="An internal error occurred. Please try again later."
)
@router.get("/zones/{zone_id}/occupancy")
async def get_zone_occupancy(
zone_id: str,
pose_service: PoseService = Depends(get_pose_service),
current_user: Optional[Dict] = Depends(get_current_user)
):
"""Get current occupancy for a specific zone."""
try:
occupancy = await pose_service.get_zone_occupancy(zone_id)
if occupancy is None:
raise HTTPException(
status_code=404,
detail=f"Zone '{zone_id}' not found"
)
return {
"zone_id": zone_id,
"current_occupancy": occupancy["count"],
"max_occupancy": occupancy.get("max_occupancy"),
"persons": occupancy["persons"],
"timestamp": occupancy["timestamp"]
}
except HTTPException:
raise
except Exception as e:
logger.error(f"Error getting zone occupancy: {e}")
raise HTTPException(
status_code=500,View on GitHub (pinned to 4685618388)
Solutions
- List zones that actually have data via GET /pose/zones/summary and use one of those ids
- Check exact id spelling and case — matching is exact
- If the zone should exist, trigger or wait for one estimation pass so occupancy is populated, then retry
Example fix
# before
zone = 'Kitchen ' # trailing space from UI input
resp = await client.get(f'/pose/zones/{zone}/occupancy')
# after
zones = (await client.get('/pose/zones/summary')).json()['zones']
zone = next(z['zone_id'] for z in zones if z['zone_id'] == 'kitchen')
resp = await client.get(f'/pose/zones/{zone}/occupancy') Defensive patterns
Strategy: validation
Validate before calling
summary = (await client.get('/pose/zones/summary')).json()
known = {z['zone_id'] for z in summary.get('zones', [])}
if zone_id not in known:
raise ValueError(f'unknown zone {zone_id!r}; known zones: {sorted(known)}') Type guard
def is_known_zone(zone_id, summary) -> bool:
return isinstance(zone_id, str) and zone_id in {z.get('zone_id') for z in summary.get('zones', [])} Try / catch
resp = await client.get(f'/pose/zones/{zone_id}/occupancy')
if resp.status_code == 404:
zone_id = await prompt_zone_selection() # re-fetch valid ids, let the user pick
resp = await client.get(f'/pose/zones/{zone_id}/occupancy')
resp.raise_for_status() Prevention
- Populate zone pickers from /zones/summary, never free-text input
- Trim and case-normalize ids before sending
- Remember a 404 here can also mean a valid zone with no data yet — retry after one estimation pass
When it happens
Trigger: GET /pose/zones/kitchen-2/occupancy where 'kitchen-2' was never provisioned or has produced no occupancy data yet — get_zone_occupancy returns None and the handler raises 404.
Common situations: Typos or stale ids after zone re-provisioning; querying right after a service restart, before the first estimation pass populates occupancy; a frontend sending display names instead of zone ids.
Related errors
- Zone '{zone_id}' not found
- Endpoint not available in production
- Client {client_id} not found
- JWT authentication is not configured. In development mode, e
- Authentication required
AI-assisted analysis of ruvnet/RuView@4685618388 (2026-08-16).
Data as JSON: /api/errors/9d524ef55a11a06a.
Report an issue: GitHub.