{"record":{"id":"870b122fb3662263","repo":"alibaba/arthas","slug":"illegal-datasource-format-must-be-line-or-tree","errorCode":null,"errorMessage":"Illegal dataSource format, must be 'line' or 'tree'","messagePattern":"Illegal dataSource format, must be 'line' or 'tree'","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"labs/arthas-jfr-frontend/public/flame-graph/flame-graph-class.js","lineNumber":613,"sourceCode":"  }\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') {\n      throw new Error('Configuration should be an object');\n    }\n    this.$configuration = configuration;\n  }\n\n  get configuration() {\n    return this.$configuration;","sourceCodeStart":595,"sourceCodeEnd":631,"githubUrl":"https://github.com/alibaba/arthas/blob/21cf2e9ba52b305290be7223b980ff504bb9cb5b/labs/arthas-jfr-frontend/public/flame-graph/flame-graph-class.js#L595-L631","documentation":"Thrown by the dataSource setter after lowercasing format, when the value is a string but is neither 'line' nor 'tree' (e.g., 'csv', 'json', 'stacks'). This is the catch-all for unsupported format identifiers even when correctly typed.","triggerScenarios":"Passing { format: 'json' } or { format: 'stacks' }; a typo such as 'tre' or 'linel'; assuming the component supports a format name from a different flame-graph library.","commonSituations":"Migrating from another profiler UI whose format names differ; payload built from a user-facing dropdown whose labels do not match 'line'/'tree'.","solutions":["Map the source format name to 'line' or 'tree' before assignment.","For flat stack-sample strings use 'line'; for nested node trees use 'tree'.","Whitelist allowed values at the call site so invalid names never reach the component."],"exampleFix":"// before\nel.dataSource = { format: 'json', data };\n\n// after\nel.dataSource = { format: 'tree', data };","handlingStrategy":"validation","validationCode":"const f = dataSource.format.toLowerCase();\nif (f !== 'line' && f !== 'tree') {\n  throw new Error(`unsupported format ${f}; expected line|tree`);\n}","typeGuard":"function isValidFormat(ds) {\n  const f = ds && typeof ds.format === 'string' ? ds.format.toLowerCase() : '';\n  return f === 'line' || f === 'tree';\n}","tryCatchPattern":null,"preventionTips":["Whitelist ['line','tree'] at the data source.","Map foreign format names to these two before assignment."],"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"}