Skip to content

Report detail page crashes with MISSING_MESSAGE for template name #420

Closed

Description

@gkhngyk

Bug

Opening a report detail page in dev crashed with a next-intl MISSING_MESSAGE error:

MISSING_MESSAGE: Could not resolve `reports.templates.executive_summary.name` in messages for locale `en`.

    at ReportDetailPage (src/app/[locale]/(dashboard)/dashboard/reports/[id]/page.tsx:175:18)

Code frame (from #419):

{KNOWN_TEMPLATE_IDS.has(report.template) && (
  <>{t(`templates.${report.template}.name`)} · </>
)}

Next.js 16.1.6 (Turbopack), locale en.

What we verified

  • web/messages/en.json contains reports.templates.executive_summary.name (all four template ids are present under the correct namespace).
  • The file parses with no duplicate keys, so nothing shadows the reports namespace.
  • NextIntlClientProvider in web/src/app/[locale]/layout.tsx receives the full message tree — there is no namespace filtering that could drop reports.templates.

So the key exists in the source, yet the running dev server could not resolve it. The most plausible cause is a stale Turbopack module cache for the dynamically imported messages/en.json (e.g. after switching branches while the dev server keeps running), which serves the old message tree against the new page code.

Proposed fix

Regardless of the cache root cause, a missing i18n key should degrade gracefully instead of taking down the whole report page:

  1. Guard the lookup with t.has(...) (available in next-intl v4) in both the report detail header and anywhere else template names are rendered (reports list, generate dialog), falling back to hiding the template label:

    {KNOWN_TEMPLATE_IDS.has(report.template) && t.has(`templates.${report.template}.name`) && (
      <>{t(`templates.${report.template}.name`)} · </>
    )}
  2. Confirm whether the error reproduces on a clean dev-server start of the branch. If it does, this is a real message-loading bug and needs deeper investigation; if not, document it as a Turbopack HMR staleness artifact.

How to reproduce (suspected)

  1. Run the dev server on a branch without the report-template i18n keys.
  2. Switch to feat(reports): templates with section picker, four new modules, deltas and change-story summary #419 without restarting the dev server.
  3. Open any generated report's detail page.

Acceptance criteria

  • Report detail page renders even when a template-name message key cannot be resolved (label is simply omitted).
  • Verified whether the error still occurs after a clean dev-server restart on the branch, and the finding is noted on this issue.

Activity

  1. added
    bug
    on Jul 13, 2026
  2. Maqbool61 commented on Jul 14, 2026

    @Maqbool61
    Contributor

    Hi, I'd like to take this on!
    My plan: add a t.has(\templates.${report.template}.name) guard at the three render sites (report detail header, reports list, generate dialog) so a missing key silently omits the template label instead of crashing the page. I'll also do a clean dev-server restart on the branch and note the finding here as the acceptance criteria requires.
    Could you assign this to me? Thanks!

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

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions