Skip to content

Long API keys cannot be stored on Windows #1085

Open

Description

@SommerEngineering

On Windows, AI Studio cannot store API keys longer than 1,280 characters. IONOS API keys are JWTs and exceed this limit, so an IONOS provider cannot be set up on Windows. The same key works on macOS.

Prerequisites

  • Windows 11
  • An IONOS API key, or any other API key longer than 1,280 characters

Steps

  1. In the settings, add an embedding provider with IONOS as the host.
  2. Paste the API key.
  3. Save.

Expected

  • The key is stored in the Windows Credential Manager, and the provider is saved.

Actual

  • Saving fails. The dialog says the key could not be stored and asks to try again, which can never succeed.
  • The log shows:
    [mindwork_ai_studio::secret] [Source = Secret Store] Failed to store secret for mindwork-ai-studio::embedding::IONOS::Qwen 3 VL::api_key and user <user>: Value of 'password encoded as UTF-16' is longer than the platform limit of 2560 chars.
    

Cause

  • The Windows Credential Manager limits a credential blob to 2,560 bytes (CRED_MAX_CREDENTIAL_BLOB_SIZE). The windows-native-keyring-store crate stores passwords as UTF-16, i.e., two bytes per character. The effective limit is therefore 1,280 characters; the "2560 chars" in the message is misleading.
  • The macOS Keychain and the Linux Secret Service have no comparable limit.

Scope

  • All secrets go through store_secret in runtime/src/secret.rs. LLM, embedding, and transcription providers are affected alike.
  • API keys rolled out through enterprise configuration plugins fail the same way. There, the failure only appears as a warning in the log, so users never learn why the provider doesn't work.

Possible fixes

  • Split long secrets across several credentials and reassemble them on read. Deleting a secret must remove all parts.
  • Store the secret as UTF-8 bytes (set_secret) instead of UTF-16 (set_password). This doubles the limit to 2,560 ASCII characters, but reading must stay compatible with existing UTF-16 entries, and it may still be too small for some tokens.
  • Either way: if a secret still cannot be stored, show a clear message instead of "Please try again".

Activity

  1. added
    bug
    on Oct 18, 2026
  2. moved this to Accepted in Roadmapon Oct 18, 2026
  3. SommerEngineering commented on Oct 18, 2026

    @SommerEngineering
    MemberAuthor

    A real IONOS key has 1,712 characters. Stored as UTF-16, that's 3,424 bytes, well above the 2,560-byte limit. As UTF-8, it would fit, but longer tokens would still fail.

    Decision

    • Split a secret across several credentials only when it exceeds the limit. Secrets that fit stay in a single UTF-16 entry as before, so existing entries need no migration.
    • The extra parts get readable names, e.g., the entry name plus ::part-2, so users can still recognize them in the Credential Manager.
    • Reading and deleting must handle all parts. When a split secret is overwritten with a shorter one, the leftover parts must be removed.
    • No upper bound and no length validation in the dialogs: with splitting, there is no limit left to check against.
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

    bug

    Type

    No type

    Projects

    • Status
      Accepted

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions