{"record":{"id":"3c57a1dabeef7454","repo":"alibaba/arthas","slug":"configuration-should-be-an-object-3c57a1","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/src/components/FlameGraph/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/src/components/FlameGraph/flame-graph-class.js#L607-L643","documentation":"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.","triggerScenarios":"Assigning element.configuration = 'dark'; assigning a number/boolean; assigning a JSON string that was not parsed.","commonSituations":"Passing a single scalar where an options bag is expected; forgetting JSON.parse on a serialized config.","solutions":["Pass a plain object such as { theme: 'dark' }.","Pass null or {} when you have no config.","Parse serialized configs with JSON.parse first."],"exampleFix":"// before\nel.configuration = cfgString; // throws\n\n// after\nel.configuration = JSON.parse(cfgString);","handlingStrategy":"type-guard","validationCode":"if (configuration != null && typeof configuration !== 'object') throw new TypeError('configuration must be object');\nel.configuration = configuration;","typeGuard":"function isConfigObject(c) { return c == null || (typeof c === 'object' && !Array.isArray(c)); }","tryCatchPattern":null,"preventionTips":["Pass a plain object or null.","JSON.parse serialized configs."],"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"}