Skip to content
This repository was archived by the owner on Mar 4, 2026. It is now read-only.
This repository was archived by the owner on Mar 4, 2026. It is now read-only.

初始化成功后,对话报错。Illegal header value b'Bearer ' #4

@meiweijia

Description

@meiweijia

Python version 3.10.8 报错信息如下,

An exception was raised while handling an update
Traceback (most recent call last):
  File "/home/mei/.local/lib/python3.10/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
    yield
  File "/home/mei/.local/lib/python3.10/site-packages/httpcore/_async/http11.py", line 121, in _send_request_headers
    event = h11.Request(
  File "/home/mei/.local/lib/python3.10/site-packages/h11/_events.py", line 96, in __init__
    self, "headers", normalize_and_validate(headers, _parsed=_parsed)
  File "/home/mei/.local/lib/python3.10/site-packages/h11/_headers.py", line 164, in normalize_and_validate
    validate(_field_value_re, value, "Illegal header value {!r}", value)
  File "/home/mei/.local/lib/python3.10/site-packages/h11/_util.py", line 91, in validate
    raise LocalProtocolError(msg)
h11._util.LocalProtocolError: Illegal header value b'Bearer '

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mei/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
    yield
  File "/home/mei/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
    resp = await self._pool.handle_async_request(req)
  File "/home/mei/.local/lib/python3.10/site-packages/httpcore/_async/connection_pool.py", line 253, in handle_async_request
    raise exc
  File "/home/mei/.local/lib/python3.10/site-packages/httpcore/_async/connection_pool.py", line 237, in handle_async_request
    response = await connection.handle_async_request(request)
  File "/home/mei/.local/lib/python3.10/site-packages/httpcore/_async/connection.py", line 90, in handle_async_request
    return await self._connection.handle_async_request(request)
  File "/home/mei/.local/lib/python3.10/site-packages/httpcore/_async/http11.py", line 112, in handle_async_request
    raise exc
  File "/home/mei/.local/lib/python3.10/site-packages/httpcore/_async/http11.py", line 80, in handle_async_request
    await self._send_request_headers(**kwargs)
  File "/home/mei/.local/lib/python3.10/site-packages/httpcore/_async/http11.py", line 120, in _send_request_headers
    with map_exceptions({h11.LocalProtocolError: LocalProtocolError}):
  File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/home/mei/.local/lib/python3.10/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
    raise to_exc(exc)
httpcore.LocalProtocolError: Illegal header value b'Bearer '

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/mei/.local/lib/python3.10/site-packages/python_telegram_bot-20.0a6-py3.10.egg/telegram/ext/_application.py", line 1057, in process_update
    await coroutine
  File "/home/mei/.local/lib/python3.10/site-packages/python_telegram_bot-20.0a6-py3.10.egg/telegram/ext/_handler.py", line 143, in handle_update
    return await self.callback(update, context)
  File "/mnt/hdd/code/ChatGPTBot/main.py", line 203, in chat
    reply = await chatbot.get_chat_response(update.message.text)
  File "/home/mei/.local/lib/python3.10/site-packages/revChatGPT/revChatGPT.py", line 265, in get_chat_response
    return await self.__get_chat_text(data)
  File "/home/mei/.local/lib/python3.10/site-packages/revChatGPT/revChatGPT.py", line 205, in __get_chat_text
    response = await s.post(
  File "/home/mei/.local/lib/python3.10/site-packages/httpx/_client.py", line 1848, in post
    return await self.request(
  File "/home/mei/.local/lib/python3.10/site-packages/httpx/_client.py", line 1533, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "/home/mei/.local/lib/python3.10/site-packages/httpx/_client.py", line 1620, in send
    response = await self._send_handling_auth(
  File "/home/mei/.local/lib/python3.10/site-packages/httpx/_client.py", line 1648, in _send_handling_auth
    response = await self._send_handling_r

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions