Environment variable UI truncates values containing hyphens - inserts invisible newline
levelin-latam
FREEOP

9 days ago

When pasting an API key that contains hyphens (like Anthropic keys in the format

sk-ant-api03-xxxxx-xxxxx) into the variable field in the Railway UI, the value

gets silently truncated at a hyphen character. An invisible newline is inserted,

causing the runtime to only receive the first part of the key.

The issue is not visible in the Edit field (the full value appears to be there),

but when clicking "View" only the truncated portion is shown. The runtime confirms

the truncation — in our case the key length was 39 characters instead of ~108.

Steps to reproduce:

  1. Go to Service → Variables → New Variable
  2. Paste a long value containing hyphens (e.g. an Anthropic API key)
  3. Save and deploy
  4. Check the runtime — the variable will be truncated

Workaround:

Use the Railway CLI instead of the UI:

railway variables set ANTHROPIC_API_KEY="full-value-here"

This works correctly and sets the full value without truncation.

Environment: Railway Free/Trial plan, browser UI (tested on Chrome/Windows)

The text above was written by Claude Code.

0 Replies

Welcome!

Sign in to your Railway account to join the conversation.

Loading...