{"record":{"id":"11389a4161da83a8","repo":"alibaba/arthas","slug":"unsupported-datasource-format-format-11389a","errorCode":null,"errorMessage":"Unsupported dataSource format ${format}","messagePattern":"Unsupported dataSource format (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"labs/arthas-jfr-frontend/src/components/FlameGraph/flame-graph-class.js","lineNumber":479,"sourceCode":"\n  genFrames() {\n    this.$root.clear();\n    this.$stackTraceMaxDepth = 0;\n    this.$totalWeight = 0;\n    this.$totalWeightOfBaseline1 = 0;\n    this.$totalWeightOfBaseline2 = 0;\n\n    if (this.$dataSource) {\n      let format = this.$dataSource.format;\n      if (format === 'line') {\n        this.genFramesFromLineData();\n      } else if (format === 'tree') {\n        if (this.$$reverse) {\n          console.warn(\"Tree format data doesn't support reverse\");\n        }\n        this.genFramesFromTreeData();\n      } else {\n        throw new Error(`Unsupported dataSource format ${format}`);\n      }\n    }\n\n    this.$root.sort();\n\n    this.$information = this.$$diff\n      ? {\n          totalWeight: this.$totalWeight,\n          totalWeightOfBaseline1: this.$totalWeightOfBaseline1,\n          totalWeightOfBaseline2: this.$totalWeightOfBaseline2\n        }\n      : {\n          totalWeight: this.$totalWeight\n        };\n\n    this.$root.text = this.$$rootTextGenerator(this.$dataSource, this.$information);\n  }\n","sourceCodeStart":461,"sourceCodeEnd":497,"githubUrl":"https://github.com/alibaba/arthas/blob/21cf2e9ba52b305290be7223b980ff504bb9cb5b/labs/arthas-jfr-frontend/src/components/FlameGraph/flame-graph-class.js#L461-L497","documentation":"Same vendored flame-graph Web Component as error 0, but the active copy lives under src/components/FlameGraph/flame-graph-class.js (the public/flame-graph/ copy is a duplicate). genFrames() compares this.$dataSource.format with === to the lowercase literals 'line'/'tree', while the setter validated using toLowerCase() and stored the original object, so a mixed-case format passes the setter and throws here.","triggerScenarios":"Assigning element.dataSource = { format: 'Line'/'TREE', ... }; mutating this.$dataSource.format after assignment; assigning $dataSource directly to bypass the setter.","commonSituations":"Backend returns capitalized format; the public/ and src/components/ copies drift and only one gets patched.","solutions":["Normalize to lowercase 'line' or 'tree' before assigning: String(format).trim().toLowerCase().","Patch genFrames() in this src/components copy to use this.$dataSource.format.toLowerCase() (mirror the fix in public/ if both are loaded).","Never mutate $dataSource.format after the setter; assign a fresh dataSource object instead."],"exampleFix":"// before\nel.dataSource = { format: rawFmt /* 'Tree' */, data };\n\n// after\nel.dataSource = { format: String(rawFmt).trim().toLowerCase(), data };","handlingStrategy":"validation","validationCode":"function normalizeDataSource(ds) {\n  if (!ds || typeof ds.format !== 'string') return null;\n  const f = ds.format.trim().toLowerCase();\n  return (f === 'line' || f === 'tree') ? { ...ds, format: f } : null;\n}\nconst safe = normalizeDataSource(raw);\nif (safe) el.dataSource = safe;","typeGuard":"function isLineOrTreeFormat(ds) {\n  return !!ds && typeof ds.format === 'string' && ['line','tree'].includes(ds.format.trim().toLowerCase());\n}","tryCatchPattern":"try { el.dataSource = raw; }\ncatch (e) { if (/Unsupported dataSource format/.test(e.message)) { el.dataSource = { ...raw, format: String(raw.format).trim().toLowerCase() }; } else throw e; }","preventionTips":["Lowercase format before assignment.","Keep the public/ and src/components/ copies in sync (or fix the root cause in genFrames)."],"tags":["flame-graph","web-component","data-validation","case-sensitivity"],"backgroundTag":null,"analyzedSha":"21cf2e9ba52b305290be7223b980ff504bb9cb5b","analyzedAt":"2026-08-14T00:57:07.243Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}