Bug: Turkish Locale - Potential Header/Key resolution failure due to case-insensitive TreeMap serialization
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
Start in openai-java-core/src/main/kotlin/com/openai/core/http/Headers.kt at the TreeMap initialization. Reproduce header lookup or token parsing under a Turkish OS locale and verify the comparison is locale-invariant. Done means standard headers such as OpenAI-Organization resolve consistently regardless of the host locale.
Written by the indexing model from the issue text.
Description
Bug Description
Applications utilizing this SDK on a Turkish OS locale face unexpected anomalies or token crashes during HTTP header parsing.
Root Cause
In openai-java-core/src/main/kotlin/com/openai/core/http/Headers.kt (Line 38), the headers map is initialized using a locale-dependent comparison mechanism:
private val map: MutableMap<String, MutableList<String>> =
TreeMap(String.CASE_INSENSITIVE_ORDER)
Java's native String.CASE_INSENSITIVE_ORDER internally triggers Character.toLowerCase(). On a Turkish host machine, this converts the capital letter I in "OpenAI-Organization" into a dotless ı, turning it into "openaı-organization".
This causes key lookup failures or broken token states when downstream interceptors (like OkHttp) process standard ASCII headers.
Related Upstream Issue
This is the Java/Kotlin ecosystem equivalent of the localization bug found in the Node SDK.
- Linked Node Issue: https://github.com/openai/openai-node/issues/1928
Suggested Official Fix
The TreeMap should enforce a locale-invariant comparator (such as Locale.ROOT) to guarantee strict ASCII/English-based casing rules across all operating systems:
TreeMap { s1, s2 -> s1.lowercase(java.util.Locale.ROOT).compareTo(s2.lowercase(java.util.Locale.ROOT)) }
- Dominant language
- Kotlin
- Stars
- 1.5k
- Forks
- 264
- Avg merge
- 13h 31m
- Merged PRs (30d)
- 89
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from openai/openai-java
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
openai/openai-java#890 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
openai/openai-java#886 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
openai/openai-java#802 · 2 comments · 3 reactions ·
-
bug sdk
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
openai/openai-java#652 · 2 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 74/100
openai/openai-java#973 ·
All issues in openai/openai-java
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
bitcoindevkit/bdk-ffi#1125 ·
-
helsemelding-json-schema json-schema-core
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
contributor: external needs review
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100