{"record":{"id":"0506942e78b488b6","repo":"OrchardCMS/OrchardCore","slug":"toprimitive-must-return-a-primitive-value","errorCode":null,"errorMessage":"@@toPrimitive must return a primitive value.","messagePattern":"@@toPrimitive must return a primitive value\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"src/OrchardCore.Modules/OrchardCore.Resources/wwwroot/Vendor/fontawesome-free-6.7.2/js/conflict-detection.js","lineNumber":47,"sourceCode":"  }\n  function _objectSpread2(e) {\n    for (var r = 1; r < arguments.length; r++) {\n      var t = null != arguments[r] ? arguments[r] : {};\n      r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {\n        _defineProperty(e, r, t[r]);\n      }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {\n        Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));\n      });\n    }\n    return e;\n  }\n  function _toPrimitive(t, r) {\n    if (\"object\" != typeof t || !t) return t;\n    var e = t[Symbol.toPrimitive];\n    if (void 0 !== e) {\n      var i = e.call(t, r || \"default\");\n      if (\"object\" != typeof i) return i;\n      throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n    }\n    return (\"string\" === r ? String : Number)(t);\n  }\n  function _toPropertyKey(t) {\n    var i = _toPrimitive(t, \"string\");\n    return \"symbol\" == typeof i ? i : i + \"\";\n  }\n\n  let _WINDOW = {};\n  let _DOCUMENT = {};\n  try {\n    if (typeof window !== 'undefined') _WINDOW = window;\n    if (typeof document !== 'undefined') _DOCUMENT = document;\n  } catch (e) {}\n  const {\n    userAgent = ''\n  } = _WINDOW.navigator || {};\n  const WINDOW = _WINDOW;","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/OrchardCMS/OrchardCore/blob/4306c0717fe573f6fca1b4955909ddab6a192807/src/OrchardCore.Modules/OrchardCore.Resources/wwwroot/Vendor/fontawesome-free-6.7.2/js/conflict-detection.js#L29-L65","documentation":"Babel's compiled _toPrimitive helper throws this TypeError when an object defines Symbol.toPrimitive but its implementation returns an object instead of a primitive. It is bundled Font Awesome minified runtime code (conflict-detection.js), part of its ES-class shims.","triggerScenarios":"Calling _toPropertyKey/_toPrimitive (e.g. computed property or spread of an object) where t[Symbol.toPrimitive](hint) returns an object such as {} or an array instead of string/number/symbol.","commonSituations":"Malformed polyfill or monkey-patched Symbol.toPrimitive; incompatible polyfill versions on the page overriding built-ins; a custom object with a buggy toPrimitive passed where a key is expected.","solutions":["Ensure Symbol.toPrimitive implementations return a primitive (string, number, or symbol)","Remove/fix conflicting polyfills that redefine Symbol.toPrimitive behavior","Verify the Font Awesome bundle version matches other bundled Babel helpers on the page"],"exampleFix":"// before\nobj[Symbol.toPrimitive] = function () { return {}; };\n// after\nobj[Symbol.toPrimitive] = function () { return String(this.label); };","handlingStrategy":"type-guard","validationCode":"function hasValidToPrimitive(o) { return typeof o !== 'object' || o === null || typeof o[Symbol.toPrimitive] !== 'function' || ['string','number','symbol'].includes(typeof o[Symbol.toPrimitive]('default')); }","typeGuard":"function returnsPrimitive(v) { const r = typeof v?.[Symbol.toPrimitive] === 'function' ? v[Symbol.toPrimitive]('default') : v; return ['string','number','symbol','bigint','boolean'].includes(typeof r) || r === null; }","tryCatchPattern":"try { doKeyConversion(obj); } catch (e) { if (e instanceof TypeError && e.message.includes('toPrimitive')) console.error('Symbol.toPrimitive must return a primitive', obj); }","preventionTips":["Never implement Symbol.toPrimitive returning objects","Avoid polyfills that override Symbol.toPrimitive globally","Keep vendor bundles and polyfill versions consistent"],"tags":["javascript","fontawesome","babel","typeerror"],"backgroundTag":"type-mismatch","analyzedSha":"4306c0717fe573f6fca1b4955909ddab6a192807","analyzedAt":"2026-09-13T17:41:05.024Z","contentChangedAt":"2026-09-13T17:41:05.024Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}