Skip to content

[ERROR] litellm.BadRequestError: Github_copilotException - bad request: missing Editor-Version header for IDE auth #93

Description

@sandyrao

I am trying to configure OpenKB for my codebase using Github Colilot as a provider. I was able to do openkb init and openkb add with the model provider github_copilot/gpt-5-mini

But when I try to do openkb query or openkb chat and pass a query it fails with the below error:
[ERROR] litellm.BadRequestError: Github_copilotException - bad request: missing Editor-Version header for IDE auth

The below is my config.yaml:

language: en
model: github_copilot/gpt-5-mini
pageindex_threshold: 20

It tried to add this to the config.yaml but it did not help
extra_headers:
"Editor-Version": "vscode/1.90.0"
"Copilot-Integration-Id": "vscode-chat"

Please provide a provision to pass the extra headers so that Github Copilot provider too can be supported.

Activity

  1. KylinMountain commented on Jun 13, 2026

    @KylinMountain
    Collaborator

    @sandyrao could you help to execute pip show litellm? I need to know the version if the litellm is root cause.

  2. sandyrao commented on Jun 13, 2026

    @sandyrao
    Author

    Hello @KylinMountain,

    $ pip show litellm
    Name: litellm
    Version: 1.83.7
    Summary: Library to easily interface with LLM API providers
    Home-page: https://litellm.ai
    Author: BerriAI
    Author-email:
    License: MIT
    Location: C:\Users<USER_NAME>\AppData\Roaming\Python\Python314\site-packages
    Requires: aiohttp, click, fastuuid, httpx, importlib-metadata, jinja2, jsonschema, openai, pydantic, python-dotenv, tiktoken, tokenizers
    Required-by: openkb, pageindex

  3. KylinMountain commented on Jun 14, 2026

    @KylinMountain
    Collaborator

    @sandyrao can you help verify this ticket with this version? you can try upgrade it by pip install openkb==0.4.0rc1. Thank you very much.

  4. sandyrao commented on Jun 14, 2026

    @sandyrao
    Author

    I am on Windows. fcntl doesnt seem to be getting resolved.

    $ openkb
    Traceback (most recent call last):
    File "", line 198, in _run_module_as_main
    File "", line 88, in run_code
    File "C:\FabricDev_WS\openKB-adoption.venv\Scripts\openkb.exe_main
    .py", line 2, in
    from openkb.cli import cli
    File "C:\FabricDev_WS\openKB-adoption.venv\Lib\site-packages\openkb\cli.py", line 44, in
    from openkb.config import (
    ...<2 lines>...
    )
    File "C:\FabricDev_WS\openKB-adoption.venv\Lib\site-packages\openkb\config.py", line 4, in
    import fcntl
    ModuleNotFoundError: No module named 'fcntl'

  5. sandyrao commented on Jun 14, 2026

    @sandyrao
    Author

    The below did the trick for me. I can also see that once this is resolved I am able to use openkb with Github Copilot by adding extra_headers within config.yaml.

    In openkb/locks.py

    import sys
    
    # Platform-neutral flock fallback
    try:
        import fcntl
    except ImportError:
        fcntl = None
    
    def flock(fd: int, exclusive: bool) -> None:
        if fcntl is not None:
            mode = fcntl.LOCK_EX if exclusive else fcntl.LOCK_SH
            fcntl.flock(fd, mode)
        elif sys.platform == "win32":
            import msvcrt
            curr = os.lseek(fd, 0, os.SEEK_CUR)
            os.lseek(fd, 0, os.SEEK_SET)
            try:
                msvcrt.locking(fd, msvcrt.LK_LOCK, 1)
            finally:
                os.lseek(fd, curr, os.SEEK_SET)
    
    def funlock(fd: int) -> None:
        if fcntl is not None:
            fcntl.flock(fd, fcntl.LOCK_UN)
        elif sys.platform == "win32":
            import msvcrt
            curr = os.lseek(fd, 0, os.SEEK_CUR)
            os.lseek(fd, 0, os.SEEK_SET)
            try:
                msvcrt.locking(fd, msvcrt.LK_UNLCK, 1)
            finally:
                os.lseek(fd, curr, os.SEEK_SET)
    

    At _fsync_directory() - line 160

    def _fsync_directory(path: Path) -> None:
        if sys.platform == "win32":
            return
        fd = os.open(path, os.O_RDONLY)
        ....
    

    At atomic_write_bytes() - line 190

        try:
            with os.fdopen(fd, "wb") as fh:
                if hasattr(os, "fchmod"):
                    os.fchmod(fh.fileno(), _target_mode(path))
    

    In openkb/config.py - line 33

    def _with_global_config_lock() -> Iterator[None]:
        GLOBAL_CONFIG_DIR.mkdir(parents=True, exist_ok=True)
        with GLOBAL_CONFIG_LOCK_PATH.open("a+", encoding="utf-8") as fh:
            flock(fh.fileno(), exclusive=True)
            try:
                yield
            finally:
                funlock(fh.fileno())
    

    Thank you so much for the great product and speedy fixes. 👍

  6. KylinMountain commented on Jun 15, 2026

    @KylinMountain
    Collaborator

    Thanks @sandyrao — and thanks for the patch, that's exactly the right approach. 🙏

    Recap for anyone following:

    1. The original GitHub Copilot missing Editor-Version header problem is solved by the extra_headers forwarding in fix: support ChatGPT-subscription & GitHub Copilot providers (litellm 1.87.2 + extra_headers) #98 (now on main) — as you confirmed.
    2. The ModuleNotFoundError: No module named 'fcntl' you then hit is a separate, Windows-only regression from the KB-locks feature (feat: add KB mutation locks and atomic state writes #86): fcntl / os.fchmod / directory fsync are all Unix-only.

    I've opened #99 to fix #2: a cross-platform flock/funlock (fcntl on POSIX, msvcrt on Windows), guarded os.fchmod, and skipping the directory fsync on Windows. I can only simulate the Windows path on macOS/Linux, so once it lands it'd be great if you could confirm on your Windows setup. Thanks again for the detailed reports!

  7. KylinMountain commented on Jun 15, 2026

    @KylinMountain
    Collaborator

    @sandyrao now you can try this version which should solve the issue about fcntl: you can upgrade it via pip install openkb==0.4.0rc3, Thanks again.

  8. sandyrao commented on Jun 15, 2026

    @sandyrao
    Author

    Confirmed by installing latest openkb to reproduce the issue and openkb==0.4.0rc3 . The fix is working in v0.4.0rc3.

    Thanks.

  9. KylinMountain commented on Jun 16, 2026

    @KylinMountain
    Collaborator

    since issue is fixed, I will close this ticket. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions