ruvnet/RuView · error · HTTPException

Router '{router_id}' not found

Error message

Router '{router_id}' not found

What it means

validate_router_access raises 404 "Router '<router_id>' not found" when domain_config.get_router(router_id) returns None — the router id is not in the loaded domain configuration. It is the router analogue of the zone-not-found check and runs before permission checks.

Source

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

                status_code=status.HTTP_403_FORBIDDEN,
                detail=f"Access denied to zone '{zone_id}'"
            )
    
    return zone_id


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

View on GitHub (pinned to 4685618388)

Solutions

  1. List configured routers (routers API or domain config) and use an exact id
  2. Verify the domain configuration file loaded and contains the router entry
  3. Fix typos/case in the router id
Defensive patterns

Strategy: validation

Validate before calling

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

Try / catch

try:
    r = client.get(f'/api/routers/{router_id}', headers=auth)
    r.raise_for_status()
except httpx.HTTPStatusError as e:
    if e.response.status_code == 404:
        refresh_router_list()  # node may have been renamed or decommissioned
    raise

Prevention

When it happens

Trigger: A path parameter router_id that matches no configured router (typo, stale id); router config not loaded; the router entry was removed after clients cached its id.

Common situations: Renamed or decommissioned ESP32 router nodes; config file not mounted in the deployment; client hardcoded ids drifting from server config.

Related errors


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