Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] TypeError: Cannot assign to read only property 'Symbol(Symbol.toStringTag)' of object '#<WeakMap>' #584

Closed
sainnhe opened this issue May 25, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@sainnhe
Copy link

sainnhe commented May 25, 2024

Describe the bug

Error at launch. Nvim reports:

[coc.nvim]: UnhandledRejection: TypeError: Cannot assign to read only property 'Symbol(Symbol.toStringTag)' of object '#<WeakMap>'

Result from CocInfo

## versions

vim version: NVIM v0.10.0
node version: v20.12.2
coc.nvim version: 0.0.82-2c7e7156 2024-05-15 09:42:33 +0800
coc.nvim directory: /home/sainnhe/.local/share/nvim/plugins/coc.nvim
term: tmux
platform: linux

## Log of coc.nvim

2024-05-25T18:44:28.949 INFO (pid:87598) [attach] - receive notification: highlight []
2024-05-25T18:44:29.056 INFO (pid:87598) [extension:coc-git] - Looking for git in: git
2024-05-25T18:44:29.108 ERROR (pid:87598) [extensions-manager] - Error on active extension coc-lists: TypeError: Cannot assign to read only property 'Symbol(Symbol.toStringTag)' of object '#<WeakMap>'
    at getRawTag (/home/sainnhe/.local/share/nvim/coc/extensions/node_modules/coc-explorer/lib/index.js:6127:27)
    at baseGetTag (/home/sainnhe/.local/share/nvim/coc/extensions/node_modules/coc-explorer/lib/index.js:6159:64)
    at Object.<anonymous> (/home/sainnhe/.local/share/nvim/coc/extensions/node_modules/coc-explorer/lib/index.js:7314:292)
    at Module.<anonymous> (/home/sainnhe/.local/share/nvim/plugins/coc.nvim/build/index.js:77963:28)
    at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
    at Module.load (node:internal/modules/cjs/loader:1206:32)
    at Module._load (node:internal/modules/cjs/loader:1022:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at Object.sandboxRequire [as require] (/home/sainnhe/.local/share/nvim/plugins/coc.nvim/build/index.js:78002:42)
    at createExtension (/home/sainnhe/.local/share/nvim/plugins/coc.nvim/build/index.js:78035:33)
2024-05-25T18:44:29.115 WARN (pid:87598) [workspace] - Extension "coc-project" registered synchronized autocmd "VimLeavePre", which could be slow.
2024-05-25T18:44:29.133 INFO (pid:87598) [plugin] - coc.nvim initialized with node: v20.12.2 after 253
2024-05-25T18:44:29.134 ERROR (pid:87598) [server] - unhandledRejection  Promise {
  <rejected> TypeError: Cannot assign to read only property 'Symbol(Symbol.toStringTag)' of object '#<WeakMap>'
      at getRawTag (/home/sainnhe/.local/share/nvim/coc/extensions/node_modules/coc-explorer/lib/index.js:6127:27)
      at baseGetTag (/home/sainnhe/.local/share/nvim/coc/extensions/node_modules/coc-explorer/lib/index.js:6159:64)
      at Object.<anonymous> (/home/sainnhe/.local/share/nvim/coc/extensions/node_modules/coc-explorer/lib/index.js:7314:292)
      at Module.<anonymous> (/home/sainnhe/.local/share/nvim/plugins/coc.nvim/build/index.js:77963:28)
      at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
      at Module.load (node:internal/modules/cjs/loader:1206:32)
      at Module._load (node:internal/modules/cjs/loader:1022:12)
      at Module.require (node:internal/modules/cjs/loader:1231:19)
      at Object.sandboxRequire [as require] (/home/sainnhe/.local/share/nvim/plugins/coc.nvim/build/index.js:78002:42)
      at createExtension (/home/sainnhe/.local/share/nvim/plugins/coc.nvim/build/index.js:78035:33)
} TypeError: Cannot assign to read only property 'Symbol(Symbol.toStringTag)' of object '#<WeakMap>'
    at getRawTag (/home/sainnhe/.local/share/nvim/coc/extensions/node_modules/coc-explorer/lib/index.js:6127:27)
    at baseGetTag (/home/sainnhe/.local/share/nvim/coc/extensions/node_modules/coc-explorer/lib/index.js:6159:64)
    at Object.<anonymous> (/home/sainnhe/.local/share/nvim/coc/extensions/node_modules/coc-explorer/lib/index.js:7314:292)
    at Module.<anonymous> (/home/sainnhe/.local/share/nvim/plugins/coc.nvim/build/index.js:77963:28)
    at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
    at Module.load (node:internal/modules/cjs/loader:1206:32)
    at Module._load (node:internal/modules/cjs/loader:1022:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at Object.sandboxRequire [as require] (/home/sainnhe/.local/share/nvim/plugins/coc.nvim/build/index.js:78002:42)
    at createExtension (/home/sainnhe/.local/share/nvim/plugins/coc.nvim/build/index.js:78035:33)
2024-05-25T18:44:29.144 INFO (pid:87598) [attach] - receive notification: runCommand [ 'explorer', '/home/sainnhe' ]
2024-05-25T18:44:29.145 ERROR (pid:87598) [node-client] - request error on "nvim_buf_attach" [ true, {} ] Error: request error on "nvim_buf_attach" - Invalid buffer id: 1
    at Document.attach (/home/sainnhe/.local/share/nvim/plugins/coc.nvim/build/index.js:43256:21)
    at Document.init (/home/sainnhe/.local/share/nvim/plugins/coc.nvim/build/index.js:43241:16)
    at new Document (/home/sainnhe/.local/share/nvim/plugins/coc.nvim/build/index.js:43126:14)
    at Documents._createDocument (/home/sainnhe/.local/share/nvim/plugins/coc.nvim/build/index.js:44113:19)
    at /home/sainnhe/.local/share/nvim/plugins/coc.nvim/build/index.js:43990:26
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2024-05-25T18:44:29.186 INFO (pid:87598) [attach] - receive notification: highlight []
2024-05-25T18:44:29.187 INFO (pid:87598) [attach] - receive notification: runCommand [ 'git.refresh' ]
2024-05-25T18:44:29.188 ERROR (pid:87598) [events] - Error on event: CursorHold Error: Buffer 2 not created.
    at Workspace.getAttachedDocument (/home/sainnhe/.local/share/nvim/plugins/coc.nvim/build/index.js:47920:25)
    at Handler.getCurrentState (/home/sainnhe/.local/share/nvim/plugins/coc.nvim/build/index.js:89227:37)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Links.getLinks (/home/sainnhe/.local/share/nvim/plugins/coc.nvim/build/index.js:85432:23)
    at async Links.getCurrentLink (/home/sainnhe/.local/share/nvim/plugins/coc.nvim/build/index.js:85438:22)
    at async Links.showTooltip (/home/sainnhe/.local/share/nvim/plugins/coc.nvim/build/index.js:85423:20)
    at async /home/sainnhe/.local/share/nvim/plugins/coc.nvim/build/index.js:85394:11
2024-05-25T18:44:29.235 INFO (pid:87598) [attach] - receive notification: doAutocmd [ 3 ]
2024-05-25T18:44:29.238 INFO (pid:87598) [attach] - receive notification: doAutocmd [ 5, 3 ]
2024-05-25T18:44:29.253 INFO (pid:87598) [attach] - receive notification: doAutocmd [ 3 ]
2024-05-25T18:44:29.264 INFO (pid:87598) [attach] - receive notification: doAutocmd [ 3 ]
2024-05-25T18:44:29.267 INFO (pid:87598) [attach] - receive notification: doAutocmd [ 3 ]
2024-05-25T18:44:32.122 INFO (pid:87598) [attach] - receive notification: showInfo []

Steps to reproduce
Steps to reproduce the behavior:

Simply open nvim and do nothing (no need to open explorer window) and this error will appear.

For more information, I'm using asahi linux fedora remix on m1 mac, and I can confirm that this error doesn't exist on macOS.

cat /etc/os-release

NAME="Fedora Linux Asahi Remix"
VERSION="40 (Forty)"
ID=fedora-asahi-remix
ID_LIKE=fedora
VERSION_ID=40
VERSION_CODENAME=""
PLATFORM_ID="platform:f40"
PRETTY_NAME="Fedora Linux Asahi Remix 40 (Forty)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora-asahi-remix:40"
DEFAULT_HOSTNAME="fedora"
HOME_URL="https://fedora-asahi-remix.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f40/system-administrators-guide/"
SUPPORT_URL="https://discussion.fedoraproject.org/c/neighbors/asahi/asahi-help/94"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=40
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=40

Expected behavior

Screenshots

Additional context
None

@sainnhe sainnhe added the bug Something isn't working label May 25, 2024
@weirongxu
Copy link
Owner

This seems to be a bug in Node.js on a specific platform. Perhaps you could try updating to the latest version of Node.js? I don't have an M1 Mac, so I can't reproduce the issue.

@sainnhe
Copy link
Author

sainnhe commented May 27, 2024

That's a very strange bug. It seems to be caused by lodash:

// node_modules/lodash-es/_getRawTag.js
var objectProto = Object.prototype;
var hasOwnProperty = objectProto.hasOwnProperty;
var nativeObjectToString = objectProto.toString;
var symToStringTag = Symbol_default ? Symbol_default.toStringTag : void 0;
function getRawTag(value) {
  var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
  try {
    value[symToStringTag] = void 0;
    var unmasked = true;
  } catch (e2) {
  }
  var result = nativeObjectToString.call(value);
  if (unmasked) {
    if (isOwn) {
      value[symToStringTag] = tag;
    } else {
      delete value[symToStringTag];
    }
  }
  return result;
}
var getRawTag_default = getRawTag;
at getRawTag (/home/sainnhe/.local/share/nvim/coc/extensions/node_modules/coc-explorer/lib/index.js:6127:27)

The getRawTag function seems to broken. I'm going to report it to the upstream.

@sainnhe
Copy link
Author

sainnhe commented May 28, 2024

Confirmed this is a packaging issue in fedora. Closed.

@sainnhe sainnhe closed this as completed May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants