Skip to content

Error starting github: CodeExpectedError: Variable 'github_token' #245707

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
toby opened this issue Apr 4, 2025 · 14 comments · May be fixed by #246927
Open

Error starting github: CodeExpectedError: Variable 'github_token' #245707

toby opened this issue Apr 4, 2025 · 14 comments · May be fixed by #246927
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug chat-mcp
Milestone

Comments

@toby
Copy link

toby commented Apr 4, 2025

Error starting github: CodeExpectedError: Variable 'github_token' must be defined in an 'inputs' section of the debug or task configuration.

cc @digitarald

Here is my config:

{
    "@azure.argTenant": "",
    "mcp": {
        "servers": {
            "github": {
                "command": "docker",
                "args": [
                    "run",
                    "-i",
                    "--rm",
                    "-e",
                    "GITHUB_PERSONAL_ACCESS_TOKEN",
                    "ghcr.io/github/github-mcp-server"
                ],
                "env": {
                    "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}"
                }
            }
        },
        "inputs": [
            {
                "id": "github_token",
                "type": "promptString",
                "description": "GitHub Personal Access Token",
                "password": true
            }
        ]
    },

}

My version:

Version: 1.100.0-insider (Universal)
Commit: c7ea9f8f6c08db68cd63dabe8edfc8555904ee42
Date: 2025-04-04T05:04:35.646Z (12 hrs ago)
Electron: 34.4.1
ElectronBuildId: 11317338
Chromium: 132.0.6834.210
Node.js: 20.18.3
V8: 13.2.152.41-electron.0
OS: Darwin arm64 24.3.0
@connor4312
Copy link
Member

Which settings.json is that in? Workspace/remote/user?

@arielfaur
Copy link

I'm experiencing the same issue. It's the user settings.

@connor4312 connor4312 added bug Issue identified by VS Code Team member as probable bug chat-mcp labels Apr 7, 2025
@arielfaur
Copy link

UPDATE: it has resolved itself by restarting vscode. Then vscode asked me for the github token.

@connor4312
Copy link
Member

This works for me in my user settings in the latest Insiders. @toby can you confirm what you're seeing / if you still repro?

Kapture.2025-04-07.at.09.31.27.mp4

@connor4312 connor4312 added the info-needed Issue requires more information from poster label Apr 7, 2025
@byjrack
Copy link

byjrack commented Apr 7, 2025

I know on user settings.json on windows (worked perfect on macOS) for 1.99.0 I still can't get inputs recognized. I also tried the reload of vscode and no change.

@connor4312
Copy link
Member

@byjrack please share your config and its path

@byjrack
Copy link

byjrack commented Apr 7, 2025

Not a problem

Image

%APPDATA%\Code\User\settings.json

{
    "remote.defaultExtensionsIfInstalledLocally": [
        "GitHub.copilot",
        "GitHub.copilot-chat",
        "GitHub.vscode-pull-request-github"
    ],
    "chat.agent.enabled": true,
    "mcp": {
    "inputs": [
      {
        "id": "github_token",
        "type": "promptString",
        "description": "GitHub Personal Access Token",
        "password": true
      },
    ],
    "servers": {
      "github": {
        "command": "docker",
        "args": [
          "run",
          "-i",
          "--rm",
          "-e",
          "GITHUB_PERSONAL_ACCESS_TOKEN",
          "ghcr.io/github/github-mcp-server"
        ],
        "env": {
          "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}"
        }
      }
    }
  }
}

@connor4312
Copy link
Member

Can you confirm the version of VS Code you're using?

@byjrack
Copy link

byjrack commented Apr 7, 2025

Can't grab the whole version, but 1.99.0 a fresh upgrade of stable. And the Chat extension was latest as well.

ammended w complete version info

Version: 1.99.0 (user setup)
Commit: 4437686
Date: 2025-04-02T21:35:19.530Z
Electron: 34.3.2
ElectronBuildId: 11161073
Chromium: 132.0.6834.210
Node.js: 20.18.3
V8: 13.2.152.41-electron.0
OS: Windows_NT x64 10.0.22631

@connor4312
Copy link
Member

Thanks! Can you see if this repro's for you on Insiders? This seems to be fixed there..

@byjrack
Copy link

byjrack commented Apr 8, 2025

So need to try a different MCP server in this case, but Insiders didn't seem to allow for docker case out of the box.

Image

I did create a stdio server in %APPDATA%\Code - Insiders\User\settings.json and getting the same error with resolving inputs.

{
    "mcp": {
        "inputs": [
        {
            "id": "github_token",
            "type": "promptString",
            "description": "GitHub Personal Access Token",
            "password": true
        }
        ],
        "servers": {
            "test": {
                "type": "stdio",
                "command": "github-mcp-server",
                "args": [ "stdio" ],
                "env": {
                "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}"
            }
        }
    }
}
}

Image

Version: 1.100.0-insider (user setup)
Commit: 86489f1015f670cc7c1ef18d937ed87d38002071
Date: 2025-04-08T08:18:59.097Z
Electron: 34.4.1
ElectronBuildId: 11317338
Chromium: 132.0.6834.210
Node.js: 20.18.3
V8: 13.2.152.41-electron.0
OS: Windows_NT x64 10.0.22631

@connor4312 connor4312 removed the info-needed Issue requires more information from poster label Apr 9, 2025
@johnpreed
Copy link

johnpreed commented Apr 12, 2025

+1

Version: 1.100.0-insider (Universal)
Commit: 043f699013796cbeae7c8fe9abac9b9eb26b3c51
Date: 2025-04-11T05:23:04.452Z (18 hrs ago)
Electron: 34.4.1
ElectronBuildId: 11317338
Chromium: 132.0.6834.210
Node.js: 20.18.3
V8: 13.2.152.41-electron.0
OS: Darwin arm64 24.3.0
{
    "mcp": {
      "inputs": [
        {
          "type": "promptString",
          "id": "github_token",
          "description": "GitHub Personal Access Token",
          "password": true
        }
      ],
      "servers": {
        "github": {
          "command": "docker",
          "args": [
            "run",
            "-i",
            "--rm",
            "-e",
            "GITHUB_PERSONAL_ACCESS_TOKEN",
            "ghcr.io/github/github-mcp-server"
          ],
          "env": {
            "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}"
          }
        }
      }
    }
  }

After running into this, I uninstalled vscode insiders, and deleted the following folder: ~/Library/Application Support/Code - Insiders and reinstalled vscode, recofigured with the same above GH MCP Server config, and I get the same error. To workaround, I can just replace ${input:github_token} with my actual PAT and it will work again. But there's definitely a problem here.

EDIT:
Copilot is trying to be helpful and will now not accept my plaintext PAT. It says it's exposed and it thinks I can't authenticate with the github-owned repo.

@johnpreed
Copy link

johnpreed commented Apr 14, 2025

AHA! Not sure if this is everyone's experience, but I was trying to launch the MCP server without an open workspace/folder.

Repro:

  1. Install VS Code Insiders
  2. Authenticate to access copilot extensions
  3. Configure new GitHub MCP server following these instructions in ~/Library/Application Support/Code - Insiders/User/settings.json
  4. Ensure Agent mode is enabled in settings
  5. Open Chat
  6. Choose Agent mode
  7. Without an open workspace/folder, start your MCP server from your settings.json

Image

Results:

Error starting github: CodeExpectedError: Variable 'github_token' must be defined in an 'inputs' section of the debug or task configuration.

Image

Cause:

You have to open a workspace or folder for this to work. This error message is misleading.

@byjrack
Copy link

byjrack commented Apr 15, 2025

And used stable 1.99.2 and can confirm the same experience. I had just been testing w Files opened before when the error was firing. Selected "Open Folder" and the input popped w/o any issues. So guessing there is an unhandled case where folder/workspace is not in scope.

@connor4312 connor4312 added this to the April 2025 milestone Apr 18, 2025
connor4312 added a commit that referenced this issue Apr 18, 2025
This behavior dates from when inputs were first added (#63910). I don't
think this does much anymore -- if a config is not found in the
requested section, undefined is returned anyway, and aborting
early doesn't get us much.

Fixes #245707
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug chat-mcp
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants