{"record":{"id":"0674b9a0820cba47","repo":"ruvnet/RuView","slug":"zone-zone-id-not-found","errorCode":null,"errorMessage":"Zone '{zone_id}' not found","messagePattern":"Zone '(.+?)' not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"archive/v1/src/api/dependencies.py","lineNumber":183,"sourceCode":"            )\n        \n        return current_user\n    \n    return check_permission\n\n\n# Zone access dependencies\nasync def validate_zone_access(\n    zone_id: str,\n    current_user: Optional[Dict[str, Any]] = Depends(get_current_user)\n) -> str:\n    \"\"\"Validate user access to a specific zone.\"\"\"\n    domain_config = get_domain_config()\n    \n    # Check if zone exists\n    zone = domain_config.get_zone(zone_id)\n    if not zone:\n        raise HTTPException(\n            status_code=status.HTTP_404_NOT_FOUND,\n            detail=f\"Zone '{zone_id}' not found\"\n        )\n    \n    # Check if zone is enabled\n    if not zone.enabled:\n        raise HTTPException(\n            status_code=status.HTTP_403_FORBIDDEN,\n            detail=f\"Zone '{zone_id}' is disabled\"\n        )\n    \n    # If authentication is enabled, check user access\n    if current_user:\n        # Admin users have access to all zones\n        if current_user.get(\"is_admin\", False):\n            return zone_id\n        \n        # Check user's zone permissions","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/ruvnet/RuView/blob/4685618388a5e49fad5b3005806f3bdd6a7c25c3/archive/v1/src/api/dependencies.py#L165-L201","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["List the valid zones (via the zones API or the domain config file) and use an exact id","Verify get_domain_config() actually loaded the expected file and the zone entry exists","Fix typos or letter-case differences in the zone id"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# Discover valid ids before calling zone-scoped routes\nzones = client.get('/api/zones', headers=auth).json()\nvalid_ids = {z['id'] for z in zones}\nif zone_id not in valid_ids:\n    raise ValueError(f'Unknown zone {zone_id!r}; valid: {sorted(valid_ids)}')\nclient.get(f'/api/zones/{zone_id}/pose', headers=auth)","typeGuard":null,"tryCatchPattern":"try:\n    r = client.get(f'/api/zones/{zone_id}/pose', headers=auth)\n    r.raise_for_status()\nexcept httpx.HTTPStatusError as e:\n    if e.response.status_code == 404:\n        refresh_zone_list()  # ids drift when server config changes\n    raise","preventionTips":["Fetch zone ids from the API at runtime instead of hardcoding them","Treat 404 on zone routes as a signal to refresh cached configuration","Log the requested id verbatim to catch typos and case mismatches"],"tags":["zones","http-404","configuration","python"],"backgroundTag":null,"analyzedSha":"4685618388a5e49fad5b3005806f3bdd6a7c25c3","analyzedAt":"2026-08-16T06:09:40.886Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}