Skip to content

panic: message "simplified_explanation" not found in language "th" on missing translation keys #2070

Open

Description

@lonelyhero77

Describe the bug

When a client sends a request with an unhandled/partially supported language in the Accept-Language header (e.g., th-TH,th;q=0.9), Anubis panics when serving the challenge page due to missing translation keys in the go-i18n localizer. This results in a 502 Bad Gateway error for the client.

Instead of falling back gracefully to the default language (e.g., en), calling MustLocalize panics and crashes the request handler.

Steps to reproduce

  1. Run the Anubis Docker container with default settings.

  2. Send an HTTP request to the Anubis-protected endpoint with the HTTP header Accept-Language: th-TH,th;q=0.9 (or any locale where simplified_explanation is missing).

  3. Observe the challenge page being triggered (issueChallenge).

  4. The server panics with panic: message "simplified_explanation" not found in language "th" and returns a 502 Bad Gateway.

Expected behavior

When a requested language key or locale is missing, Anubis should fall back to the default language (English) or use Localize with proper error handling/fallback instead of calling MustLocalize which triggers a runtime panic.

Your operating system and its version.

iPhone OS 18_7 like Mac OS X

Your browser and its version.

AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.6.1 Mobile/15E148 Safari/604.1

Additional context

Log Output / Stack Trace
http: panic serving 172.18.0.6:48896: message "simplified_explanation" not found in language "th" goroutine 4963 [running]: net/http.(*conn).serve.func1() net/http/server.go:1939 +0xac panic({0x2529b18?, 0x7f62f72db0?}) runtime/panic.go:859 +0x120 github.com/nicksnyder/go-i18n/v2/i18n.(*Localizer).MustLocalize(0x2893388?, 0x7f62794270?) github.com/nicksnyder/go-i18n/v2@v2.6.1/i18n/localizer.go:235 +0x3c github.com/TecharoHQ/anubis/lib/localization.(*SimpleLocalizer).T(...) github.com/TecharoHQ/anubis/lib/localization/localization.go:121 ...

Activity

  1. dwhitemv25 commented on Oct 25, 2026

    @dwhitemv25
    Contributor

    Submitted PR #2072 to address this. I'm not in a good place to test alternate languages, though, so if you could apply the patch and test in your env it would be appreciated. I think it is set up to do fallback as long as your browser says that english is allowed to be returned. If you see simplified_explanation when you expand the explanation tab during challenges then that might be the case, check what Accept-Language header your browser is sending.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions