Skip to content

Bug: Turkish Locale Crash - Header name must be a valid HTTP token ["openaı-organization"] #12568

Closed as not planned

Description

@yalcinmuhammed

Before submitting your bug report

Relevant environment info

- OS: Windows (with Turkish locale / tr-TR)
- Continue version: Latest
- IDE version: Android Studio Panda 1 / VS Code
- Model: OpenAI: gpt-oss-120b (free) via OpenRouter
- config:
  
  models:
    - name: "OpenAI: gpt-oss-120b (free)"
      provider: openrouter
      model: openai/gpt-oss-120b:free
      apiKey: "sk-or-v1-..."

Description

Bug Description

When using Continue on a Turkish Windows/OS environment with third-party OpenAI-compatible providers (like OpenRouter or SiliconFlow), the extension crashes instantly with the following error:
TypeError: Header name must be a valid HTTP token ["openaı-organization"]

Root Cause

The underlying openai-node SDK normalizes technical headers using a native .toLowerCase() call, which converts "OpenAI-Organization" to "openaı-organization" (with a dotless ı) under Turkish language rules.

Linked Upstream Bugs

This crash is caused by lack of locale-invariance in upstream OpenAI SDKs:

🛠️ Temporary Workaround for Affected Users

Until this is officially patched, you can fix it manually in your IDE.

For VS Code users:

  1. Open the Continue extension bundle file located at: C:\Users\<YourUsername>\.vscode\extensions\continue.continue-<version>\dist\extension.js
  2. Search for "OpenAI-Organization" and "OpenAI-Project".
  3. Replace them entirely with strict lowercase strings: "openai-organization" and "openai-project".
  4. Save the file and restart the IDE. This completely bypasses the runtime crash.

Note for Android Studio / JetBrains users: This manual source modification workaround is not applicable/effective for the .jar files in Android Studio (C:\Users\<YourUsername>\AppData\Roaming\Google\AndroidStudio<Version>\plugins\continue-intellij-extension\lib\) because the codebase is bundled in a binary compiled format.

Suggested Fix for Continue Team

Continue can insulate its environment from this upstream bug by ensuring that the Core Server node processes are explicitly spawned with a locale-invariant environment flag (e.g., forcing LANG=en_US.UTF-8 on process spawn) so third-party npm packages never fallback to Turkish casing rules.

Suggested Fixes for Continue Team

Continue can easily isolate and resolve this upstream serialization bug at the codebase level. Here are the two definitive methods to handle the fix within the repository:

Method 1: Intercept and Neutralize Headers in core/llm/llms/OpenAI.ts

The Continue team can directly inject a header-sanitization layer inside the _getHeaders() method around in core/llm/llms/OpenAI.ts (Line 378). By enforcing explicit lowercased fallback keys when using third-party proxies (like OpenRouter), we can stop the underlying SDK from runtime casing evaluations that trigger the Turkish locale crash.

protected _getHeaders() {
    const headers: Record<string, string> = {
      "Content-Type": "application/json",
      ...(this.apiKey && { Authorization: `Bearer ${this.apiKey}` }),
      "api-key": this.apiKey ?? "", // For Azure
    };

    // Hotfix for Turkish Locale (Turkish I Problem): Prevent upstream camelCase 
    // properties from triggering native string transformations on non-OpenAI endpoints
    if (this.apiBase && !this.apiBase.includes("://openai.com")) {
      headers["openai-organization"] = "";
      headers["openai-project"] = "";
    }

    return headers;
}

Method 2: Global String Prototype Patch (Polyfill Entrypoint Hotfix)

Since Continue compiles its core server into a singular bundle file (extension.js), adding an environment-invariant polyfill at the absolute entrypoint of the application (main.ts or index.ts) will safely guard against the Turkish I-problem globally across all bundled third-party npm modules:

// Add at the very top of Continue Core Server entrypoint file
if ('I'.toLowerCase() === 'ı') {
  const originalToLowerCase = String.prototype.toLowerCase;
  String.prototype.toLowerCase = function() {
    // If the target string contains technical OpenAI casing keys, enforce safe conversion
    if (this.includes('OpenAI-')) {
      return this.toLocaleLowerCase('en-US');
    }
    return originalToLowerCase.call(this);
  };
}

To reproduce

  • To reproduce:
    1. Set the Windows OS language/locale to Turkish (tr-TR).
    2. Install the Continue extension in Android Studio or VS Code.
    3. Configure a model using provider: openrouter in config.yaml.
    4. Send any message in the chat panel.
    5. The model fails immediately, throwing the TypeError: Header name must be a valid HTTP token ["openaı-organization"] exception in the panel/logs due to the dotless "ı" transformation.

Log output

Activity

  1. added
    area:integration
    ide:jetbrains
    ide:vscode
    kind:bug
    os:windows
    on Jun 6, 2026
  2. github-actions commented on Sep 5, 2026

    @github-actions
    Contributor

    This issue hasn't been updated in 90 days and will be closed after an additional 10 days without activity. If it's still important, please leave a comment and share any new information that would help us address the issue.

  3. github-actions commented on Sep 15, 2026

    @github-actions
    Contributor

    This issue was closed because it wasn't updated for 10 days after being marked stale. If it's still important, you are welcome to leave a comment and this will keep the issue open. However please note that this repo is no longer being actively maintained.

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

    area:integrationide:jetbrainside:vscodekind:bugos:windowsstale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions