{"record":{"id":"940c6ff80bae40fc","repo":"xtekky/gpt4free","slug":"no-cookies-found-for-cls-domain","errorCode":null,"errorMessage":"No cookies found for {cls.domain}","messagePattern":"No cookies found for (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"g4f/Provider/needs_auth/Reka.py","lineNumber":35,"sourceCode":"    cookies = {}\n\n    @classmethod\n    def create_completion(\n        cls,\n        model: str,\n        messages: Messages,\n        stream: bool = True,\n        proxy: str = None,\n        api_key: str = None,\n        image: ImageType = None,\n        **kwargs,\n    ) -> CreateResult:\n        cls.proxy = proxy\n\n        if not api_key:\n            cls.cookies = get_cookies(cls.domain, cache_result=False)\n            if not cls.cookies:\n                raise ValueError(f\"No cookies found for {cls.domain}\")\n            elif \"appSession\" not in cls.cookies:\n                raise ValueError(\n                    f\"No appSession found in cookies for {cls.domain}, log in or provide bearer_auth\"\n                )\n            api_key = cls.get_access_token(cls)\n\n        conversation = []\n        for message in messages:\n            conversation.append(\n                {\n                    \"type\": \"human\",\n                    \"text\": message[\"content\"],\n                }\n            )\n\n        if image:\n            image_url = cls.upload_image(cls, api_key, image)\n            conversation[-1][\"image_url\"] = image_url","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/xtekky/gpt4free/blob/973504e1770928ed5fb82f43da528f441ad9ddc3/g4f/Provider/needs_auth/Reka.py#L17-L53","documentation":"Raised as ValueError by the Reka provider when no api_key was passed and get_cookies(cls.domain) returned nothing — the browser cookie store has no cookies at all for Reka's domain. Without cookies the provider cannot mint an access token via its /bff/auth/access_token endpoint.","triggerScenarios":"Calling Reka without api_key on a machine whose browser has never logged in to the Reka domain, so the cookie lookup is empty.","commonSituations":"Fresh machine/container with no browser profile, cookies cleared, running headless in CI where no browser cookies exist.","solutions":["Pass api_key (bearer token) directly to the call to skip cookie-based auth","Log in to Reka in your default browser so g4f can read the cookies, then retry","If cookies exist in a non-default browser profile, export them to where g4f's get_cookies looks"],"exampleFix":"# before\nresponse = client.chat.completions.create(model='reka-core', messages=msgs)  # ValueError\n\n# after\nresponse = client.chat.completions.create(model='reka-core', messages=msgs, api_key=os.environ['REKA_API_KEY'])","handlingStrategy":"validation","validationCode":"from g4f.requests import get_cookies\nif not os.environ.get('REKA_API_KEY') and not get_cookies('reka.ai'):\n    raise SystemExit('Log in to reka.ai in your browser or set REKA_API_KEY')","typeGuard":"def reka_auth_ready(api_key: str | None) -> bool:\n    if api_key:\n        return True\n    from g4f.requests import get_cookies\n    return bool(get_cookies('reka.ai'))","tryCatchPattern":"try:\n    result = ...create(model='reka-core', ...)\nexcept ValueError as e:\n    if 'No cookies found' in str(e):\n        result = ...create(model='reka-core', api_key=os.environ['REKA_API_KEY'])\n    else:\n        raise","preventionTips":["Prefer explicit api_key in automated environments; browser cookies only work where a browser profile exists","Check cookie availability at startup on servers/containers before routing Reka traffic"],"tags":["authentication","cookies","reka","g4f"],"backgroundTag":null,"analyzedSha":"973504e1770928ed5fb82f43da528f441ad9ddc3","analyzedAt":"2026-08-14T23:45:32.408Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}