koala73/worldmonitor · error · Error
Visualization failed
Error message
Visualization failed
What it means
UI error in McpDataPanel.autoVisualize: the server-side visualization stream completed but the widget HTML could not be rendered (setSafeContent failed, e.g. the generated HTML was rejected or rendering threw). The error surfaces in the panel while the raw JSON data itself is intact.
Source
Thrown at src/components/McpDataPanel.ts:240
for (const line of lines) {
if (!line.startsWith('data: ')) continue;
let event: { type: string; [k: string]: unknown };
try { event = JSON.parse(line.slice(6)); } catch { continue; }
if (event.type === 'html_complete') {
resultHtml = String(event.html ?? '');
} else if (event.type === 'done') {
// Only cache and render if data hasn't changed since we started
if (this.pendingHash === this.lastJsonHash) {
this.cachedWidgetHtml = resultHtml;
this.setSafeContent(unsafeRawHtml(`
<div class="mcp-panel-meta">${this.buildMetaLine()}</div>
<div class="mcp-panel-content mcp-panel-widget">${wrapProWidgetHtml(resultHtml)}</div>
`, 'legacy Panel.setContent() migration'));
rendered = true;
}
} else if (event.type === 'error') {
throw new Error(String(event.message ?? t('mcp.visualizationFailed')));
}
}
}
// Stream ended without 'done' — flush whatever html_complete gave us
if (!rendered) {
if (resultHtml && this.pendingHash === this.lastJsonHash) {
this.cachedWidgetHtml = resultHtml;
this.setSafeContent(unsafeRawHtml(`
<div class="mcp-panel-meta">${this.buildMetaLine()}</div>
<div class="mcp-panel-content mcp-panel-widget">${wrapProWidgetHtml(resultHtml)}</div>
`, 'legacy Panel.setContent() migration'));
} else if (!resultHtml) {
this.cachedWidgetHtml = null;
this.lastJsonHash = null;
this.showError(t('mcp.visualizationFailed'));
}
}View on GitHub (pinned to eeab0a219f)
Solutions
- Fall back to viewing the raw JSON result instead of the visualization
- Retry auto-visualize; transient failures of the widget renderer are possible
- Report the dataset if visualization consistently fails — it may produce HTML the sanitizer rejects
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at src/components/McpDataPanel.ts:240 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of koala73/worldmonitor@eeab0a219f (2026-08-21).
Data as JSON: /api/errors/7efcc1476edf7c7e.
Report an issue: GitHub.