{"record":{"id":"18a60a7402c85d88","repo":"alibaba/arthas","slug":"configuration-should-be-an-object","errorCode":null,"errorMessage":"Configuration should be an object","messagePattern":"Configuration should be an object","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"labs/arthas-jfr-frontend/public/flame-graph/flame-graph-class.js","lineNumber":625,"sourceCode":"    }\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;\n  }\n\n  getConfigItemOrDefault(name, def) {\n    if (this.$configuration && this.$configuration[name]) {\n      return this.$configuration[name];\n    }\n    return def;\n  }\n\n  _(name, def) {\n    return this.getConfigItemOrDefault(name, def);\n  }","sourceCodeStart":607,"sourceCodeEnd":643,"githubUrl":"https://github.com/alibaba/arthas/blob/21cf2e9ba52b305290be7223b980ff504bb9cb5b/labs/arthas-jfr-frontend/public/flame-graph/flame-graph-class.js#L607-L643","documentation":"Thrown by the configuration setter when typeof configuration !== 'object'. Note typeof null === 'object' and typeof [] === 'object', so null and arrays pass this check; primitives like string, number, boolean, undefined, bigint, and symbol fail. The component stores whatever object is given and later reads config items by key via getConfigItemOrDefault.","triggerScenarios":"Assigning element.configuration = 'dark' (a string) or a number/boolean; passing undefined explicitly; assigning a primitive where an options bag was expected.","commonSituations":"Confusing a single config flag (e.g., theme) with the whole configuration object; passing a serialized string instead of a parsed object.","solutions":["Pass a plain options object, e.g., element.configuration = { theme: 'dark' }.","If you have no config, omit the assignment or pass null/{} (both accepted).","Parse JSON strings with JSON.parse before assigning."],"exampleFix":"// before\nel.configuration = '{\"theme\":\"dark\"}'; // string, throws\n\n// after\nel.configuration = JSON.parse('{\"theme\":\"dark\"}');\n// or\nel.configuration = { theme: 'dark' };","handlingStrategy":"type-guard","validationCode":"if (configuration !== undefined && configuration !== null && typeof configuration !== 'object') {\n  throw new TypeError('configuration must be an object');\n}\nel.configuration = configuration;","typeGuard":"function isConfigObject(c) { return c == null || (typeof c === 'object' && !Array.isArray(c)); }","tryCatchPattern":null,"preventionTips":["Always pass a plain object (or null) for configuration.","JSON.parse serialized configs before assigning."],"tags":["flame-graph","web-component","type-validation"],"backgroundTag":null,"analyzedSha":"21cf2e9ba52b305290be7223b980ff504bb9cb5b","analyzedAt":"2026-08-14T00:57:07.243Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}