{"record":{"id":"6a85fb94960258bc","repo":"odysseus-dev/odysseus","slug":"cannot-reach-v1-models","errorCode":null,"errorMessage":"Cannot reach /v1/models","messagePattern":"Cannot reach /v1/models","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"routes/session_routes.py","lineNumber":394,"sourceCode":"            validation_headers = build_headers(effective_api_key, endpoint_base_url or endpoint_url)\n\n        if skip_val:\n            # skip_validation = trust the caller and do NOT probe /v1/models.\n            # Used for custom endpoints AND for bare placeholder sessions with no\n            # model at all (e.g. an email reply draft just needs a session to live\n            # in). Probing here was 400-ing those with \"Cannot reach /v1/models\".\n            pass\n        elif not model_to_use:\n            from src.llm_core import list_model_ids\n            ids = list_model_ids(\n                endpoint_url,\n                timeout=SESSION_MODEL_VALIDATION_TIMEOUT,\n                headers=validation_headers,\n                owner=user,\n                endpoint_id=endpoint_id.strip() if endpoint_id else None,\n            )\n            if not ids:\n                raise HTTPException(400, \"Cannot reach /v1/models\")\n            # Default to the first CHAT model — endpoints often list embedding/\n            # tts/whisper models first (e.g. text-embedding-ada-002), which\n            # can't hold a conversation.\n            _NON_CHAT = (\"text-embedding\", \"embedding\", \"tts-\", \"whisper\",\n                         \"text-moderation\", \"moderation-\", \"dall-e\", \"rerank\")\n            chat_ids = [m for m in ids if not any(p in m.lower() for p in _NON_CHAT)]\n            model_to_use = (chat_ids or ids)[0]\n        else:\n            from src.llm_core import list_model_ids\n            import os as _os\n            req_base = _os.path.basename(model_to_use.rstrip(\"/\"))\n            avail = list_model_ids(\n                endpoint_url,\n                timeout=SESSION_MODEL_VALIDATION_TIMEOUT,\n                headers=validation_headers,\n                owner=user,\n                endpoint_id=endpoint_id.strip() if endpoint_id else None,\n            )","sourceCodeStart":376,"sourceCodeEnd":412,"githubUrl":"https://github.com/odysseus-dev/odysseus/blob/f9235ebbf13f693a6fd29ce70b097f6ec83705bf/routes/session_routes.py#L376-L412","documentation":"Error \"Cannot reach /v1/models\" 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":["Verify the endpoint server is running and /v1/models is reachable.","Check the base URL and network path, then retry."],"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-15T22:17:37.221Z"}