-
Notifications
You must be signed in to change notification settings - Fork 2k
Open
Description
Issue: OpenAI API Key Configuration in .env File
Problem
When setting up the Letta server via the installer, the .env file may be created with quoted values for API keys. This causes the server to fail when attempting to use OpenAI API keys, resulting in 500 errors when creating agents.
Root Causes
-
Quoted Environment Variables
- Docker's
--env-fileflag includes quotes as part of the environment variable value - If
.envcontains:OPENAI_API_KEY="sk-proj-..." - Docker sets:
OPENAI_API_KEY="sk-proj-..."(with quotes in the value) - This causes OpenAI API to reject requests with "Invalid authorization header"
- Docker's
-
Missing LETTA_ENCRYPTION_KEY
- Letta's Secret class requires
LETTA_ENCRYPTION_KEYto be set, even if encryption is not actively used - Without it, the Secret class may incorrectly identify API keys as encrypted and fail to decrypt them
- This results in
Nonebeing returned instead of the actual API key
- Letta's Secret class requires
Required Fixes
-
Ensure .env file format does not include quotes around values:
# ✅ Correct OPENAI_API_KEY=sk-proj-abc123... # ❌ Incorrect OPENAI_API_KEY="sk-proj-abc123..."
-
Ensure LETTA_ENCRYPTION_KEY is set in .env:
LETTA_ENCRYPTION_KEY=dummy-encryption-key-32-chars-long!!Note: This is required even if encryption is not being used.
Impact
- Severity: High
- User Impact: Server cannot authenticate with OpenAI API, agent creation fails
- Workaround: Manual editing of .env file after installation
References
See detailed incident report for full technical details and investigation.
Metadata
Metadata
Assignees
Labels
No labels