Site Tools


Hotfix release available: 2026-07-14a "Mort". upgrade now! [57.1] (what's this?)
New release available: 2026-07-14 "Mort". upgrade now! [57] (what's this?)
troubleshooting:lemmy_ui_500_error_environment_variables

Lemmy UI 500 Error After Version Upgrade

Status: Resolved
Date: 2026-07-21
Affected service: Lemmy

Symptom

After upgrading Lemmy from 0.19.5 to 0.19.19, the Lemmy UI container returned HTTP 500 errors for all requests. The health check showed the container as unhealthy with repeated failures. The backend API was responding correctly with valid JSON, but the UI could not render pages.

Diagnosis

Check the Lemmy UI container logs:

docker logs folkzone-lemmy-ui --tail 50

The logs showed the UI starting successfully but returning 500 errors on health checks:

Lemmy-ui v0.19.19 started listening on http://0.0.0.0:1234
127.0.0.1 - - [21/Jul/2026:07:13:35 +0000] "HEAD / HTTP/1.1" 500 5234 "-" "curl/8.14.1"

Testing the backend API directly from within the UI container showed it was working:

docker exec folkzone-lemmy-ui curl -s http://folkzone-lemmy-backend:8536/api/v3/site

This returned valid JSON with site data, confirming the backend was healthy.

Checking the rendered HTML from the UI showed the problem:

window.isoData = {"path":"\u002F","site_res":undefined,"routeData":{},"errorPageData":{},"showAdultConsentModal":false,"lemmy_external_host":"0.0.0.0:8536"};

The site_res field was undefined, indicating the UI could not fetch site data from the backend during server-side rendering.

Root Cause

Lemmy UI 0.19.x changed the environment variable naming convention. The docker-compose.yml was using the old double-underscore format:

LEMMY_UI__LEMMY_EXTERNAL_HOST=lemmy.folk.zone
LEMMY_UI__LEMMY_INTERNAL_HOST=folkzone-lemmy-backend:8536
LEMMY_UI__LEMMY_HTTPS=false

Lemmy UI 0.19.19 expects single underscores:

LEMMY_UI_LEMMY_EXTERNAL_HOST=lemmy.folk.zone
LEMMY_UI_LEMMY_INTERNAL_HOST=folkzone-lemmy-backend:8536
LEMMY_UI_HTTPS=false

With the incorrect variable names, the UI defaulted to 0.0.0.0:8536 for the external host, which caused server-side rendering to fail when fetching site data.

Fix

Update the docker-compose.yml environment variables for the Lemmy UI service to use single underscores:

folkzone-lemmy-ui:
  image: dessalines/lemmy-ui:0.19.19
  container_name: folkzone-lemmy-ui
  environment:
    TZ: America/Edmonton
    LEMMY_UI_LEMMY_EXTERNAL_HOST: lemmy.folk.zone
    LEMMY_UI_LEMMY_INTERNAL_HOST: folkzone-lemmy-backend:8536
    LEMMY_UI_HTTPS: "false"

Deploy the updated compose file and restart the UI:

rsync -avz -e "ssh -i ~/.omg-lol-keys/id_ed25519" server/docker-compose.yml brennan@192.168.1.65:/home/brennan/homelab/
ssh -i ~/.omg-lol-keys/id_ed25519 -T -o BatchMode=yes brennan@192.168.1.65 "cd /home/brennan/homelab && docker compose up -d folkzone-lemmy-ui"

After restart, verify the UI is returning HTTP 200:

docker logs folkzone-lemmy-ui --tail 10

You should see successful requests:

127.0.0.1 - - [21/Jul/2026:07:16:17 +0000] "HEAD / HTTP/1.1" 200 24285 "-" "curl/8.14.1"

Configuration File Setup

The Lemmy backend configuration file at server/lemmy/lemmy.hjson must contain actual secret values, not placeholders. Update these fields with values from the server .env file:

{
  database: {
    host: "folkzone-lemmy-db"
    port: 5432
    database: "lemmy"
    user: "lemmy"
    password: "REPLACE_WITH_LEMMY_POSTGRES_PASSWORD"
  }
  hostname: "lemmy.folk.zone"
  email: {
    smtp_server: "smtp.resend.com:587"
    smtp_login: "resend"
    smtp_password: "REPLACE_WITH_RESEND_API_KEY"
    smtp_from_address: "noreply@folk.zone"
    tls_type: "starttls"
  }
  pictrs: {
    url: "http://folkzone-lemmy-pictrs:8080/"
    api_key: "REPLACE_WITH_LEMMY_PICTRS_API_KEY"
  }
  setup: {
    admin_username: "admin"
    admin_password: "REPLACE_WITH_ADMIN_PASSWORD_ON_FIRST_BOOT"
    admin_email: "hello@folk.zone"
    site_name: "folk.lemmy"
  }
}

Deploy the updated configuration:

rsync -avz -e "ssh -i ~/.omg-lol-keys/id_ed25519" server/lemmy/lemmy.hjson brennan@192.168.1.65:/home/brennan/homelab/lemmy/lemmy.hjson
ssh -i ~/.omg-lol-keys/id_ed25519 -T -o BatchMode=yes brennan@192.168.1.65 "cd /home/brennan/homelab && docker compose up -d folkzone-lemmy-backend"

Version Upgrade Notes

When upgrading Lemmy, always upgrade both the backend and UI to matching versions. The docker-compose.yml should use the same version tag for both services:

folkzone-lemmy-backend:
  image: dessalines/lemmy:0.19.19

folkzone-lemmy-ui:
  image: dessalines/lemmy-ui:0.19.19

Check the official Lemmy documentation for the latest stable version and any breaking changes in environment variables between versions.

See Also

troubleshooting/lemmy_ui_500_error_environment_variables.txt · Last modified: by 127.0.0.1