{"record":{"id":"f952610d5ec81bfd","repo":"OrchardCMS/OrchardCore","slug":"toprimitive-must-return-a-primitive-value-regular","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/regular.js","lineNumber":59,"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  var S = {\n      classic: {\n        fa: \"solid\",\n        fas: \"solid\",\n        \"fa-solid\": \"solid\",\n        far: \"regular\",\n        \"fa-regular\": \"regular\",\n        fal: \"light\",\n        \"fa-light\": \"light\",\n        fat: \"thin\",","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/OrchardCMS/OrchardCore/blob/4306c0717fe573f6fca1b4955909ddab6a192807/src/OrchardCore.Modules/OrchardCore.Resources/wwwroot/Vendor/fontawesome-free-6.7.2/js/regular.js#L41-L77","documentation":"Internal helper in the bundled Font Awesome UMD bundle: _toPrimitive calls the value's Symbol.toPrimitive method and the result is an object instead of a primitive. This is a transpiled runtime invariant failure, not an Orchard Core error — it occurs only when consumer script passes exotic objects into Font Awesome APIs. Fix by updating the vendored fontawesome package or reporting upstream.","triggerScenarios":"A computed property / key conversion in regular.js hitting an object whose Symbol.toPrimitive(hint) returns {} or another non-primitive.","commonSituations":"Global polyfill conflicts; monkey-patching Object/Symbol prototypes on the page; corrupted or mismatched vendor bundles shipped together.","solutions":["Ensure Symbol.toPrimitive returns a primitive value","Audit and remove polyfills that override Symbol/Object prototype behavior","Regenerate or update the regular.js vendor bundle"],"exampleFix":"// before\nkey[Symbol.toPrimitive] = () => new Object();\n// after\nkey[Symbol.toPrimitive] = (hint) => hint === 'string' ? 'key' : 1;","handlingStrategy":"type-guard","validationCode":"function safeKey(o) { if (typeof o?.[Symbol.toPrimitive] === 'function') { const r = o[Symbol.toPrimitive]('string'); if (typeof r === 'object') throw new TypeError('toPrimitive returned object'); return r; } return o; }","typeGuard":"function hasPrimitiveToPrimitive(o) { const f = o?.[Symbol.toPrimitive]; return typeof f !== 'function' || ['string','number','symbol'].includes(typeof f.call(o, 'string')); }","tryCatchPattern":"try { loadRegularIcons(); } catch (e) { if (e instanceof TypeError && e.message.includes('toPrimitive')) console.error('Polyfill conflict detected'); }","preventionTips":["Audit global polyfills for Symbol.toPrimitive overrides","Keep fontawesome.js and regular.js from the same Font Awesome version","Test icon bundles with the site's full polyfill set"],"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-15T23:17:13.987Z"}