ElevenLabs TTS fails with 'Invalid URL' error due to Windows line endings in .env file #8501
Unanswered
lliWcWill
asked this question in
Troubleshooting
Replies: 1 comment 1 reply
-
Enclose the variable with quotation marks. Example: TTS_API_KEY="sk_your_secret_key" |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
What happened?
ElevenLabs TTS "Invalid URL" Fix
Problem
ElevenLabs Text-to-Speech was failing with "Invalid URL" error when trying to generate speech.
Root Cause
The
.env
file contained Windows-style line endings (CRLF -\r\n
) instead of Unix-style line endings (LF -\n
).When the Docker container (Linux-based) read the environment variables, it included the carriage return character (
\r
) as part of the API key value, making it:This invisible
\r
character in the HTTP header caused axios to throw an "Invalid URL" error because HTTP headers cannot contain carriage return characters.Environment Details
Solution
Remove carriage returns from the
.env
file:sed -i 's/\r$//' .env
Prevention
To prevent this issue in the future when working with WSL:
.env
files.gitattributes
file with:dos2unix
command on Windows-created files before using them in WSL/DockerAdditional Notes
Code Changes Made
client/src/hooks/Input/useTextToSpeechExternal.ts
to prevent empty voice parametersVersion Information
librechat/librechat-dev latest a74e99cdfe84 45 hours ago 1.11GB
ghcr.io/danny-avila/librechat-rag-api-dev-lite latest 8858d2bd9ff5 6 days ago 1.48GB
librechat/librechat-dev e6f1d6b9f0fd 2 weeks ago 1.11GB
librechat/librechat-dev 9bab928b3d9b 3 weeks ago 1.11GB
ghcr.io/danny-avila/librechat-rag-api-dev-lite 6a1dfa1c7fe0 3 weeks ago 1.47GB
librechat/librechat-dev 81bf2def0a96 3 weeks ago 1.08GB
librechat/librechat-dev fae62246f0ce 3 months ago 953MB
ghcr.io/danny-avila/librechat-rag-api-dev-lite 817faebddae9 3 months ago 1.31GB
librechat/librechat-dev 782f80a8c1e4 4 months ago 888MB
librechat/librechat-dev e59f99c159d5 5 months ago 865MB
librechat/librechat-dev 46fa79e130dd 5 months ago 856MB
librechat/librechat-dev 6f44a2bdbcd5 6 months ago 893MB
ghcr.io/danny-avila/librechat-rag-api-dev-lite 095db2c2ff3b 7 months ago 1.29GB
librechat/librechat-dev 670428d9310f 7 months ago 855MB
ghcr.io/danny-avila/librechat-rag-api-dev-lite 0c9252dfa7de 7 months ago 2.1GB
Steps to Reproduce
.env
file using a Windows text editor (VS Code, Cursor, Notepad, etc.)librechat.yaml
with ElevenLabs TTS settings:docker compose up
What browsers are you seeing the problem on?
Chrome
Relevant log output
Screenshots
No response
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions