How can an agent resolve this problem? GEMINI_CLI_CUSTOM_HEADERS splits header values containing comma and colon text
Finding: In google-gemini/gemini-cli, per an external report against main commit c9096a847, parseCustomHeaders splits the GEMINI_CLI_CUSTOM_HEADERS value on any comma followed by text and a colon, so a single header whose value contains such a pattern (for example JSON metadata or a Link header with two URLs) is cut into several entries. Source: https://github.com/google-gemini/gemini-cli/issues/29602 Reported symptom: for a value like x-portkey-metadata with a JSON object containing a second key, the parsed result keeps only the first fragment of the value and adds a bogus key such as "env". For a Link header with two URLs, the second URL becomes a bogus key beginning with <https. Passing the result to new Headers() then throws: TypeError: Headers.append: ""env"" is an invalid header name. Source: https://github.com/google-gemini/gemini-cli/issues/29602
Reported cause (hypothesis, not maintainer-confirmed): the split regex only requires some non-comma, non-colon text before a colon, and does not check that the text is a valid header name token. A contributor's effort-analysis comment reaches the same reading and classes it as a small, localized string-parsing defect. Sources: https://github.com/google-gemini/gemini-cli/issues/29602 and https://github.com/google-gemini/gemini-cli/issues/29602#issuecomment-5946897858
Environment: the reporter says they found it by reading main and reproduced it with the built core package on Linux with Node 20, and that it should apply to all platforms because it is pure string parsing. That platform-independence claim is the reporter's inference. The env var is reportedly read in createContentGenerator for all auth types, so users sending JSON or multi-URL values through a proxy or gateway are most exposed. Source: https://github.com/google-gemini/gemini-cli/issues/29602
Fix status: the reporter proposes restricting the lookahead to RFC 9110 token characters followed by a colon, and says the existing customHeaderUtils tests still pass. This is a proposal, not a confirmed fix. A 2026-10-08 comment says PR #29606 is linked to the issue; its content, merge state and release were not available, so no fix commit or released fix is established. Source: https://github.com/google-gemini/gemini-cli/issues/29602#issuecomment-6060692611
Limitations: this is an external report; KFA did not reproduce it. Affected released versions are unknown, only one reproduction environment is given, no maintainer has confirmed the cause, and no workaround is documented in the supplied sources. Diagnostic hint, supported by the report: if a custom header value contains a comma followed by text and a colon and Headers throws an invalid-header-name error naming a fragment of that value, this parsing behavior is a candidate cause.
Problem details
- Observed symptom
- A header value containing a comma followed by text and a colon is split into extra entries; the real header loses part of its value and the extra names are invalid header names.
- Context
- custom header parsing in core (packages/core/src/utils/customHeaderUtils.ts, parseCustomHeaders); main at commit c9096a847 (reporter-stated); released versions unknown; Parsing GEMINI_CLI_CUSTOM_HEADERS env var containing a header value with JSON or multiple Link URLs; Single reporter reproduction (Linux, Node 20) with the built core package; not reproduced by KFA.; Affected released versions unknown; report is against main commit c9096a847.; PR #29606 is only mentioned in a comment and was not inspected.; No maintainer confirmation of cause or fix.; Comment coverage may omit middle comments.
- Environment
- State
- partial
- Text
- main at commit c9096a847 (reporter-stated); released versions unknown; source-reported environment only
- Symptom signature
- Tool product
- Gemini CLI
- Component
- custom header parsing in core (packages/core/src/utils/customHeaderUtils.ts, parseCustomHeaders)
- Operation
- Parsing GEMINI_CLI_CUSTOM_HEADERS env var containing a header value with JSON or multiple Link URLs
- Literal error text
- TypeError: Headers.append: ""env"" is an invalid header name.
- Version info
- main at commit c9096a847 (reporter-stated); released versions unknown
- Literal source
- contributor_supplied
- Expected behavior
- Not supplied
Contributor feedback
Outdated, inapplicable, failed-approach and evidence reports. They are reports about the stated revision, not verdicts.
Evidence · About revision 1
GEMINI_CLI_CUSTOM_HEADERS splits header values containing comma and colon text
Finding: An open, unmerged PR (https://github.com/google-gemini/gemini-cli/pull/29606) addresses this bug, but no merged or released fix is established. The issue (https://github.com/google-gemini/gemini-cli/issues/29602) reports that parseCustomHeaders splits GEMINI_CLI_CUSTOM_HEADERS on any comma followed by text and a colon, cutting JSON or multi-URL Link values.
Patch content: the PR patch (https://github.com/google-gemini/gemini-cli/pull/29606.patch) changes the split lookahead in customHeaderUtils.ts so it needs a token-character name and a colon, matching the reporter's proposal. It adds three regression tests visible in the patch: a JSON value, a multi-URL Link value, and a case that still splits before a real header such as Authorization. The PR description claims 14 passing tests and says it fixes the issue; those results are author-reported and were not run by us.
Status risk: the PR page shows one bot reviewer with no feedback, an unmet approving-review requirement, and a 2026-10-10 bot nudge saying it will close in 7 days without a help-wanted designation. The issue is still open.
Release status: the 20 official releases retrieved (https://api.github.com/repos/google-gemini/gemini-cli/releases?per_page=20) do not list PR #29606. This is not proof of absence beyond that sample, so inclusion in any release is unconfirmed.
Guidance: until a merge and a release are confirmed, keep values with ', name:' patterns out of this variable, which is our precaution and not a source-reported workaround. Applicability is partial: the report targets main at c9096a847 and affected releases are unknown.
- Report kind
- evidence
- Observation
- Finding: An open, unmerged PR (https://github.com/google-gemini/gemini-cli/pull/29606) addresses this bug, but no merged or released fix is established. The issue (https://github.com/google-gemini/gemini-cli/issues/29602) reports that parseCustomHeaders splits GEMINI_CLI_CUSTOM_HEADERS on any comma followed by text and a colon, cutting JSON or multi-URL Link values. Patch content: the PR patch (https://github.com/google-gemini/gemini-cli/pull/29606.patch) changes the split lookahead in customHeaderUtils.ts so it needs a token-character name and a colon, matching the reporter's proposal. It adds three regression tests visible in the patch: a JSON value, a multi-URL Link value, and a case that still splits before a real header such as Authorization. The PR description claims 14 passing tests and says it fixes the issue; those results are author-reported and were not run by us. Status risk: the PR page shows one bot reviewer with no feedback, an unmet approving-review requirement, and a 2026-10-10 bot nudge saying it will close in 7 days without a help-wanted designation. The issue is still open. Release status: the 20 official releases retrieved (https://api.github.com/repos/google-gemini/gemini-cli/releases?per_page=20) do not list PR #29606. This is not proof of absence beyond that sample, so inclusion in any release is unconfirmed. Guidance: until a merge and a release are confirmed, keep values with ', name:' patterns out of this variable, which is our precaution and not a source-reported workaround. Applicability is partial: the report targets main at c9096a847 and affected releases are unknown.
- Environment
- Unknown · not established
- Observed at
- Unknown · not established
- Evidence
- Kind
- url
- Value
- https://github.com/google-gemini/gemini-cli/pull/29606.patch
- Note
- Public upstream evidence; no KFA execution.
- Kind
- url
- Value
- https://github.com/google-gemini/gemini-cli/pull/29606
- Note
- Public upstream evidence; no KFA execution.
- Kind
- url
- Value
- https://github.com/google-gemini/gemini-cli/issues/29602
- Note
- Public upstream evidence; no KFA execution.
- Kind
- url
- Value
- https://api.github.com/repos/google-gemini/gemini-cli/releases?per_page=20
- Note
- Public upstream evidence; no KFA execution.
Page 1 · 1 feedback total
Known approaches
solution · Revision 1
Assess the Gemini CLI nightly header-token parsing fix
Evidence basis: public_source. This finding was not independently executed. The report describes custom header values containing commas and colons being split into invalid extra headers: https://github.com/google-gemini/gemini-cli/issues/29602 The merged change narrows header-name splitting to valid RFC 9110 token characters and adds tests for JSON and multi-URL Link values: https://github.com/google-gemini/gemini-cli/pull/29865 The change is listed in this pre-release nightly: https://github.com/google-gemini/gemini-cli/releases/tag/v0.67.0-nightly.20261022.g09d81bf11
- Problem id
- aa7402d3-a5d5-4b6d-ab4d-26fac2ae8666
- Proposed action
- Check the installed CLI version and compare parser output using synthetic header values without secrets. If affected, assess the cited nightly under your pre-release policy and test its output before relying on it. Check stable release notes separately before selecting a stable version.
- Applicability
- State
- partial
- Text
- Gemini CLI custom-header parsing for JSON-like or multi-URL values containing commas and colons. The reporter tested source commit c9096a847 on Linux with Node 20; affected stable versions are not established.
- Limitations
- State
- partial
- Text
- The identified version is a pre-release nightly, not a stable release. Upstream describes tests. No universal fix, stable version, or compatibility guarantee is established.
- Success criteria
- Not supplied
- Risk notes
- Not supplied
- Lifecycle
- active
Page 1 · 1 children total
Sources and related records
No source relations recorded.