{"record":{"id":"be7c823140181456","repo":"odysseus-dev/odysseus","slug":"internal-error","errorCode":null,"errorMessage":"Internal error","messagePattern":"Internal error","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"routes/model_routes.py","lineNumber":1642,"sourceCode":"        try:\n            if getattr(request.state, \"api_token\", False):\n                scopes = set(getattr(request.state, \"api_token_scopes\", []) or [])\n                if \"chat\" not in scopes:\n                    raise HTTPException(403, \"API token is not scoped for chat\")\n                if not getattr(request.state, \"api_token_owner\", None):\n                    raise HTTPException(403, \"API token has no owner\")\n            owner = effective_user(request) or \"\"\n\n            # Reject anonymous in configured deployments — no leaking the model\n            # list to unauthenticated callers.\n            auth_mgr = getattr(request.app.state, \"auth_manager\", None)\n            if not owner and not _auth_disabled() and auth_mgr is not None and getattr(auth_mgr, \"is_configured\", False):\n                raise HTTPException(401, \"Not authenticated\")\n        except HTTPException:\n            raise\n        except Exception as e:\n            logger.error(\"Auth gate error in GET /api/models, failing closed: %s\", e)\n            raise HTTPException(status_code=500, detail=\"Internal error\")\n        # Admins see every endpoint (they manage the global pool); regular\n        # users get the owner-scoped view.\n        _is_admin = False\n        try:\n            auth_mgr = getattr(request.app.state, \"auth_manager\", None)\n            if owner and auth_mgr is not None and getattr(auth_mgr, \"is_admin\", None):\n                _is_admin = bool(auth_mgr.is_admin(owner))\n        except Exception:\n            _is_admin = False\n        now = _time.time()\n        # Cache key includes the admin flag so a demotion / promotion doesn't\n        # serve the wrong scoped view from cache.\n        _cache_key = (owner, _is_admin)\n        cache_entry = _models_cache.get(_cache_key)\n        if not refresh and cache_entry is not None and (now - cache_entry[\"time\"]) < _MODELS_CACHE_TTL:\n            return cache_entry[\"data\"]\n        result = _fetch_models(owner=owner, is_admin=_is_admin)\n        _models_cache[_cache_key] = {\"data\": result, \"time\": now}","sourceCodeStart":1624,"sourceCodeEnd":1660,"githubUrl":"https://github.com/odysseus-dev/odysseus/blob/f9235ebbf13f693a6fd29ce70b097f6ec83705bf/routes/model_routes.py#L1624-L1660","documentation":"Error \"Internal error\" thrown in odysseus-dev/odysseus.","triggerScenarios":"Triggered when the corresponding server-side validation or runtime check at the recorded location rejects the request or operation and returns this error message to the caller.","commonSituations":"See trigger scenarios.","solutions":["Check the server logs for the stack trace of this internal error.","Retry the request; report the issue if it persists."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f9235ebbf13f693a6fd29ce70b097f6ec83705bf","analyzedAt":"2026-08-14T21:47:48.359Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}