Skip to content

MCP server discovery failure: ByteString conversion error when using non-ASCII characters in headers #25668

@stepaluch

Description

@stepaluch

What happened?

The MCP server discovery process fails when the configuration headers contain non-ASCII characters (like 'ą').
It appears that Gemini CLI attempts to convert these header values into a ByteString (restricted to 255), causing an overflow error when a Unicode character is encountered.

Steps to Reproduce:

  1. Configure an MCP server in settings.json
"mcpServers": {
		"mcp": {
			"httpUrl": "https://mcp",
			"headers": {
				"X-Custom": "mąka",
			},
			"timeout": 60000
		},
  1. Trigger the discovery process for the server.

What did you expect to happen?

convert non-ascii characters automatically

Client information

  • CLI Version: 0.38.2
  • Git Commit: b0ed611
  • Session ID: 977679c3-feec-4261-98ad-bf1baf1720d6
  • Operating System: win32 v25.0.0
  • Sandbox Environment: no sandbox
  • Model Version: gemini-3.1-flash-lite-preview
  • Auth Type: oauth-personal
  • Memory Usage: 332.6 MB
  • Terminal Name: Unknown
  • Terminal Background: #0c0c0c
  • Kitty Keyboard Protocol: Unsupported

Login information

No response

Anything else we need to know?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/agentIssues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Qualitykind/bugpriority/p2Important but can be addressed in a future release.status/bot-triagedtype/bug

    Type

    No fields configured for Bug.

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions