{"record":{"id":"a4da5f3812ffa743","repo":"alibaba/arthas","slug":"should-specify-the-format-of-datasource-line-or-a4da5f","errorCode":null,"errorMessage":"Should specify the format of dataSource: 'line' or 'tree'","messagePattern":"Should specify the format of dataSource: 'line' or 'tree'","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"labs/arthas-jfr-frontend/src/components/FlameGraph/flame-graph-class.js","lineNumber":606,"sourceCode":"\n  set downward(downward) {\n    this.toggleAttribute('downward', !!downward);\n  }\n\n  static get observedAttributes() {\n    return ['width', 'height', 'downward'];\n  }\n\n  attributeChangedCallback(name, oldVal, newVal) {\n    if (!this.$dataSource || oldVal === newVal) {\n      return;\n    }\n    this.render(true, false);\n  }\n\n  set dataSource(dataSource) {\n    if (!dataSource.format) {\n      throw new Error(\"Should specify the format of dataSource: 'line' or 'tree'\");\n    }\n    if (typeof dataSource.format !== 'string') {\n      throw new Error('Illegal dataSource format type, must be string');\n    }\n    let format = dataSource.format.toLowerCase();\n    if ('line' !== format && 'tree' !== format) {\n      throw new Error(\"Illegal dataSource format, must be 'line' or 'tree'\");\n    }\n    this.$dataSource = dataSource;\n    this.render(true, true);\n  }\n\n  get dataSource() {\n    return this.$dataSource;\n  }\n\n  set configuration(configuration) {\n    if (typeof configuration !== 'object') {","sourceCodeStart":588,"sourceCodeEnd":624,"githubUrl":"https://github.com/alibaba/arthas/blob/21cf2e9ba52b305290be7223b980ff504bb9cb5b/labs/arthas-jfr-frontend/src/components/FlameGraph/flame-graph-class.js#L588-L624","documentation":"dataSource setter in src/components/FlameGraph/flame-graph-class.js throws when format is falsy. The component must know whether to run genFramesFromLineData or genFramesFromTreeData, so an absent format is rejected up front.","triggerScenarios":"Assigning a dataSource object without a format key; format set to '' , null, or undefined.","commonSituations":"Payload schema changed upstream; partial object spread omitted format.","solutions":["Include format: 'line' or format: 'tree' in the dataSource.","Default the field from your data shape before assigning.","Guard at the call site so an incomplete dataSource is never assigned."],"exampleFix":"// before\nel.dataSource = payload; // payload has no format\n\n// after\nel.dataSource = { format: detectFormat(payload), ...payload };","handlingStrategy":"type-guard","validationCode":"if (!dataSource || !dataSource.format) throw new Error('format required');\nel.dataSource = dataSource;","typeGuard":"function hasFormat(ds) { return !!ds && !!ds.format; }","tryCatchPattern":null,"preventionTips":["Make format required in your payload schema.","Detect format from data shape when omitted."],"tags":["flame-graph","web-component","data-validation"],"backgroundTag":null,"analyzedSha":"21cf2e9ba52b305290be7223b980ff504bb9cb5b","analyzedAt":"2026-08-14T00:57:07.243Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}