On this page

Environment variable troubleshooting

Last updated: 2026-11-10

This page collects the most common .env configuration problems. Every example uses placeholders. Never put real keys, authorization codes or administrator passwords into documentation, tickets or chat logs.

1. Where the file lives and when it takes effect

chmod 600 .env
wasmx stop . && wasmx start .

2. Syntax rules (the usual culprit)

Use KEY=VALUE, one variable per line:

SMTP_FROM_NAME='Keragi notifications'
SMTP_PASSWORD='authorization-code-with-#'

3. Core variables

VariablePurposeCommon problem
WASMX_ADDRListen addressContainers must use 0.0.0.0:3001; bare metal should use 127.0.0.1:3001 behind a proxy
WASMX_DBHost SQLite URLNeeds a writable directory and a persistent volume in containers; resource databases use *_DB_URL
JWT_SECRETShared signing secret for the host and userxAt least 32 random characters; changing it invalidates all existing tokens
OPEN_REGISTRATIONAllow self-service sign-upTurn off when not needed in production
BOOTSTRAP_ADMIN_CREDENTIALAdministrator created on first startOnly applies when the database is empty; changing it later does not change an existing password
BOOTSTRAP_ADMIN_PASSWORDInitial administrator passwordUse upper/lower case, digits and a special character
USERX_ADMIN_URLInternal URL the host uses for userxMust match WASMX_ADDR and the resource prefix
USERX_PUBLIC_URLuserx URL used by clientsUse the public URL when behind a proxy or same-origin deployment
USERX_ADMIN_CREDENTIAL / USERX_ADMIN_PASSWORDAdmin credentials the host uses for userxMust match the bootstrap administrator

4. Email and registration

4.1 SMTP variables

VariableDescription
SMTP_HOSTSMTP server
SMTP_PORTPort; 465 for implicit TLS, 587 for STARTTLS
SMTP_TLSimplicit or starttls
SMTP_USERNAMELogin account; also used as the From address
SMTP_PASSWORDAuthorization code / app password (not the mailbox login password)
SMTP_FROM_NAMEDisplay name; quote it if it contains spaces or non-ASCII characters

4.2 Common SMTP failures

SymptomCauseFix
535 authentication failedWrong host, mailbox password used instead of an authorization code, or an unquoted # in the codeEnterprise mail usually needs smtp.qiye.163.com; personal mail uses smtp.163.com. Quote the code with single quotes
Startup log says SMTP 未配置The three required variables (host / username / password) are not all presentConfigure all three and restart
No verification emailMessage filtered, From differs from the account, or rate limitCheck wasmx.log, spam, and the From address; SMTP_USERNAME must be the sender
The API returns the plaintext codeThe operator enabled a development-only debug switchAsk the operator to disable it and restart; production must never return plaintext codes
No sign-up entry on the login pageOPEN_REGISTRATION=falseSet it to true and restart, or create accounts as admin only

To verify email delivery, call the captcha endpoint with a real mailbox you can read, then check the log and inbox. Never write the test authorization code into any document.

5. AI models (agix)

If an AI conversation reports:

model 'deepseek-flash' not configured

the model catalog contains that registry name, but no provider resolved for it. Ask the user to add their key in the client under Settings → AI assistant → Model key configuration. Keep only the base URL in the server .env:

AGIX_DEFAULT_MODEL=deepseek-flash
AGIX_DEEPSEEK_URL=https://api.deepseek.com/v1

Do not put a shared model key in .env for convenience: it leaks through backups and logs and bills every user to one credential.

Notes:

Verify:

curl -X POST http://127.0.0.1:3001/agix/v1/responses \
  -H "Authorization: Bearer <token>" -H 'Content-Type: application/json' \
  -d '{"model":"deepseek-flash","input":"Reply with exactly OK"}'

6. Connectors and approval origins (not resource config in .env)

6.1 provider unavailable

conn.providers in wasmx.json is an explicit list, empty by default:

"providers": ["claude", "codex"]

6.2 403 非法 Origin

The approval page validates the request origin. When accessed through a reverse proxy or another port, the operator must add the actual access origin to the approval allowlist and restart; a restart clears pending approvals.

6.3 CORS

Same-origin deployments need no CORS. If the frontend and API are on different servers, prefer reverse-proxying the four resource paths from the frontend server. If cross-origin is unavoidable, list the origins explicitly:

WASMX_CORS_ORIGINS=https://app.example.com,https://app.keragi.com

7. Ports and networking

8. Security checklist

9. Verify after changes

wasmx status .

Check wasmx.log for startup lines such as SMTP 已配置 and agent backend 已注册. If it is still broken after 30 seconds, roll .env back to the last known-good version and add changes back one at a time.