Two functions in packages/stx/src/document-shell.ts merge config head tags into a page. One dedups. The other does not.
generateDocumentShell (:396-402) prepends a hardcoded pair and then straight-concatenates whatever config supplies:
const defaultMeta = [
{ charset: 'UTF-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1.0' },
]
const allMeta = [...defaultMeta, ...meta]injectConfigHeadTags (same file, ~:576-598) does the opposite — it builds a dedup key from name= / property= / charset= / http-equiv= and skips anything already in the head. Its docblock even advertises this: "Idempotent: skips a <script src>, <link href>, meta name/property/charset/http-equiv…".
Result
Declaring charset or viewport in app.head.meta — the obvious place to put site-wide head tags — emits two <meta charset> and two <meta name="viewport"> on every page that goes through the shell, while pages topped up by injectConfigHeadTags correctly get one. Measured on a real app; it is why stacksjs/analyticshq's config/ui.ts carries a comment telling the next person not to declare them there.
The failure is silent and shape-dependent: the same config produces different head output depending on whether the page owns its document or not.
Fix
Apply the existing dedup in generateDocumentShell too — the key-building logic in injectConfigHeadTags already handles charset, so it can be extracted and shared rather than reimplemented.