{"record":{"id":"7efcc1476edf7c7e","repo":"koala73/worldmonitor","slug":"visualization-failed","errorCode":null,"errorMessage":"Visualization failed","messagePattern":"Visualization failed","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/components/McpDataPanel.ts","lineNumber":240,"sourceCode":"        for (const line of lines) {\n          if (!line.startsWith('data: ')) continue;\n          let event: { type: string; [k: string]: unknown };\n          try { event = JSON.parse(line.slice(6)); } catch { continue; }\n\n          if (event.type === 'html_complete') {\n            resultHtml = String(event.html ?? '');\n          } else if (event.type === 'done') {\n            // Only cache and render if data hasn't changed since we started\n            if (this.pendingHash === this.lastJsonHash) {\n              this.cachedWidgetHtml = resultHtml;\n              this.setSafeContent(unsafeRawHtml(`\n                <div class=\"mcp-panel-meta\">${this.buildMetaLine()}</div>\n                <div class=\"mcp-panel-content mcp-panel-widget\">${wrapProWidgetHtml(resultHtml)}</div>\n              `, 'legacy Panel.setContent() migration'));\n              rendered = true;\n            }\n          } else if (event.type === 'error') {\n            throw new Error(String(event.message ?? t('mcp.visualizationFailed')));\n          }\n        }\n      }\n\n      // Stream ended without 'done' — flush whatever html_complete gave us\n      if (!rendered) {\n        if (resultHtml && this.pendingHash === this.lastJsonHash) {\n          this.cachedWidgetHtml = resultHtml;\n          this.setSafeContent(unsafeRawHtml(`\n            <div class=\"mcp-panel-meta\">${this.buildMetaLine()}</div>\n            <div class=\"mcp-panel-content mcp-panel-widget\">${wrapProWidgetHtml(resultHtml)}</div>\n          `, 'legacy Panel.setContent() migration'));\n        } else if (!resultHtml) {\n          this.cachedWidgetHtml = null;\n          this.lastJsonHash = null;\n          this.showError(t('mcp.visualizationFailed'));\n        }\n      }","sourceCodeStart":222,"sourceCodeEnd":258,"githubUrl":"https://github.com/koala73/worldmonitor/blob/eeab0a219fce0f02a00603b532dbae9041b934ac/src/components/McpDataPanel.ts#L222-L258","documentation":"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.","triggerScenarios":"Thrown at src/components/McpDataPanel.ts:240 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"eeab0a219fce0f02a00603b532dbae9041b934ac","analyzedAt":"2026-08-21T16:51:25.751Z","contentChangedAt":"2026-08-21T16:51:25.751Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}