alibaba/arthas · error · Error
Illegal dataSource format, must be 'line' or 'tree'
Error message
Illegal dataSource format, must be 'line' or 'tree'
What it means
dataSource setter lowercases format and throws if it is not exactly 'line' or 'tree'. Unlike error 5/0 (which uses raw case), this setter path is case-insensitive; it only rejects genuinely unsupported format names.
Source
Thrown at labs/arthas-jfr-frontend/src/components/FlameGraph/flame-graph-class.js:613
}
attributeChangedCallback(name, oldVal, newVal) {
if (!this.$dataSource || oldVal === newVal) {
return;
}
this.render(true, false);
}
set dataSource(dataSource) {
if (!dataSource.format) {
throw new Error("Should specify the format of dataSource: 'line' or 'tree'");
}
if (typeof dataSource.format !== 'string') {
throw new Error('Illegal dataSource format type, must be string');
}
let format = dataSource.format.toLowerCase();
if ('line' !== format && 'tree' !== format) {
throw new Error("Illegal dataSource format, must be 'line' or 'tree'");
}
this.$dataSource = dataSource;
this.render(true, true);
}
get dataSource() {
return this.$dataSource;
}
set configuration(configuration) {
if (typeof configuration !== 'object') {
throw new Error('Configuration should be an object');
}
this.$configuration = configuration;
}
get configuration() {
return this.$configuration;View on GitHub (pinned to 21cf2e9ba5)
Solutions
- Translate the upstream format name to 'line' or 'tree'.
- Use 'line' for sample strings and 'tree' for nested node structures.
- Constrain the input source to the two allowed values.
Example fix
// before
el.dataSource = { format: 'stacks', data };
// after
el.dataSource = { format: 'line', data }; Defensive patterns
Strategy: validation
Validate before calling
const f = dataSource.format.toLowerCase();
if (f !== 'line' && f !== 'tree') throw new Error('unsupported format ' + f); Type guard
function isValidFormat(ds) { const f = ds && typeof ds.format === 'string' ? ds.format.toLowerCase() : ''; return f === 'line' || f === 'tree'; } Prevention
- Constrain format input to line|tree.
- Translate upstream format names at the boundary.
When it happens
Trigger: Passing { format: 'csv' }, { format: 'json' }, or a typo like 'tre'.
Common situations: Format name from another profiler; user-facing label that does not map to the two supported names.
Related errors
- Unsupported dataSource format ${format}
- Should specify the format of dataSource: 'line' or 'tree'
- Illegal dataSource format, must be 'line' or 'tree'
- Unsupported dataSource format ${format}
- Should specify the format of dataSource: 'line' or 'tree'
AI-assisted analysis of alibaba/arthas@21cf2e9ba5 (2026-08-14).
Data as JSON: /api/errors/c6b908fe1dd71444.
Report an issue: GitHub.