alibaba/arthas · error · Error
Configuration should be an object
Error message
Configuration should be an object
What it means
configuration setter throws when typeof configuration !== 'object'. null and arrays pass (typeof both yield 'object'); primitives are rejected. The object is later consulted key-by-key by getConfigItemOrDefault, so a primitive has no usable keys.
Source
Thrown at labs/arthas-jfr-frontend/src/components/FlameGraph/flame-graph-class.js:625
}
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;
}
getConfigItemOrDefault(name, def) {
if (this.$configuration && this.$configuration[name]) {
return this.$configuration[name];
}
return def;
}
_(name, def) {
return this.getConfigItemOrDefault(name, def);
}View on GitHub (pinned to 21cf2e9ba5)
Solutions
- Pass a plain object such as { theme: 'dark' }.
- Pass null or {} when you have no config.
- Parse serialized configs with JSON.parse first.
Example fix
// before el.configuration = cfgString; // throws // after el.configuration = JSON.parse(cfgString);
Defensive patterns
Strategy: type-guard
Validate before calling
if (configuration != null && typeof configuration !== 'object') throw new TypeError('configuration must be object');
el.configuration = configuration; Type guard
function isConfigObject(c) { return c == null || (typeof c === 'object' && !Array.isArray(c)); } Prevention
- Pass a plain object or null.
- JSON.parse serialized configs.
When it happens
Trigger: Assigning element.configuration = 'dark'; assigning a number/boolean; assigning a JSON string that was not parsed.
Common situations: Passing a single scalar where an options bag is expected; forgetting JSON.parse on a serialized config.
Related errors
- Illegal dataSource format type, must be string
- Configuration should be an object
- Illegal dataSource format type, must be string
- 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/3c57a1dabeef7454.
Report an issue: GitHub.