Skip to content

Error when fetch for Leetcode question 362 design hit counter #652

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

Open
jinxuan opened this issue Nov 28, 2020 · 3 comments
Open

Error when fetch for Leetcode question 362 design hit counter #652

jinxuan opened this issue Nov 28, 2020 · 3 comments

Comments

@jinxuan
Copy link

jinxuan commented Nov 28, 2020

🐛 Bug Report

When fetching this problem, crash with an exception

To Reproduce

Search this specific problem

Expected behavior

A clear and concise description of what you expected to happen.

Extension Output

Paste here the LeetCode extension log from output channel.

/Users/***/.vscode/extensions/leetcode.vscode-leetcode-0.17.0/node_modules/yargs/yargs.js:1242
      else throw err
           ^

TypeError: Cannot read property 'includes' of null
    at Plugin.plugin.getProblem (/Users/***/.vscode/extensions/leetcode.vscode-leetcode-0.17.0/node_modules/vsc-leetcode-cli/lib/plugins/cache.js:31:24)
    at Plugin.plugin.getProblem (/Users/***/.vscode/extensions/leetcode.vscode-leetcode-0.17.0/node_modules/vsc-leetcode-cli/lib/plugins/solution.discuss.js:75:15)
    at /Users/***/.vscode/extensions/leetcode.vscode-leetcode-0.17.0/node_modules/vsc-leetcode-cli/lib/core.js:98:15
    at /Users/***/.vscode/extensions/leetcode.vscode-leetcode-0.17.0/node_modules/vsc-leetcode-cli/lib/plugins/company.js:1527:12
    at Plugin.plugin.getProblems (/Users/***/.vscode/extensions/leetcode.vscode-leetcode-0.17.0/node_modules/vsc-leetcode-cli/lib/plugins/cache.js:16:12)
    at Plugin.plugin.getProblems (/Users/***/.vscode/extensions/leetcode.vscode-leetcode-0.17.0/node_modules/vsc-leetcode-cli/lib/plugins/company.js:1515:15)
    at Plugin.core.getProblem (/Users/***/.vscode/extensions/leetcode.vscode-leetcode-0.17.0/node_modules/vsc-leetcode-cli/lib/core.js:89:8)
    at Object.cmd.handler (/Users/***/.vscode/extensions/leetcode.vscode-leetcode-0.17.0/node_modules/vsc-leetcode-cli/lib/commands/show.js:178:10)
    at Object.runCommand (/Users/***/.vscode/extensions/leetcode.vscode-leetcode-0.17.0/node_modules/yargs/lib/command.js:240:40)
    at Object.parseArgs [as _parseArgs] (/Users/***/.vscode/extensions/leetcode.vscode-leetcode-0.17.0/node_modules/yargs/yargs.js:1154:41)

Your Environment

  • os: Mac OS
  • nodejs version: 12.18.2
  • vscode version: 1.51.1
  • extension version: 0.17.0
@Ricccccky
Copy link

Have the same error when fetching question 1274 Number of Ships in a Rectangle.

@SR2k
Copy link

SR2k commented May 8, 2021

Same error when trying to fetch 276 at CN site with a paid account.

TypeError: Cannot read property 'includes' of null
    at Plugin.plugin.getProblem (/Users/sr2k/.vscode/extensions/leetcode.vscode-leetcode-0.17.0/node_modules/vsc-leetcode-cli/lib/plugins/cache.js:31:24)
    at Plugin.plugin.getProblem (/Users/sr2k/.vscode/extensions/leetcode.vscode-leetcode-0.17.0/node_modules/vsc-leetcode-cli/lib/plugins/solution.discuss.js:75:15)
    at /Users/sr2k/.vscode/extensions/leetcode.vscode-leetcode-0.17.0/node_modules/vsc-leetcode-cli/lib/core.js:98:15
    at /Users/sr2k/.vscode/extensions/leetcode.vscode-leetcode-0.17.0/node_modules/vsc-leetcode-cli/lib/plugins/company.js:1527:12
    at Plugin.plugin.getProblems (/Users/sr2k/.vscode/extensions/leetcode.vscode-leetcode-0.17.0/node_modules/vsc-leetcode-cli/lib/plugins/cache.js:16:12)
    at Plugin.plugin.getProblems (/Users/sr2k/.vscode/extensions/leetcode.vscode-leetcode-0.17.0/node_modules/vsc-leetcode-cli/lib/plugins/company.js:1515:15)
    at Plugin.core.getProblem (/Users/sr2k/.vscode/extensions/leetcode.vscode-leetcode-0.17.0/node_modules/vsc-leetcode-cli/lib/core.js:89:8)
    at Object.cmd.handler (/Users/sr2k/.vscode/extensions/leetcode.vscode-leetcode-0.17.0/node_modules/vsc-leetcode-cli/lib/commands/show.js:178:10)
    at Object.runCommand (/Users/sr2k/.vscode/extensions/leetcode.vscode-leetcode-0.17.0/node_modules/yargs/lib/command.js:240:40)
    at Object.parseArgs [as _parseArgs] (/Users/sr2k/.vscode/extensions/leetcode.vscode-leetcode-0.17.0/node_modules/yargs/yargs.js:1154:41)

@sam-6174
Copy link

sam-6174 commented Oct 13, 2021

This is a bug within the underlying leetcode-cli tool, for example running leetcode show 635 -l python3 outputs:

/usr/local/lib/node_modules/leetcode-cli/node_modules/yargs/yargs.js:1148
      else throw err
           ^

TypeError: Cannot read property 'map' of null
    at showProblem (/usr/local/lib/node_modules/leetcode-cli/lib/commands/show.js:99:6)
    at /usr/local/lib/node_modules/leetcode-cli/lib/commands/show.js:174:7
    at /usr/local/lib/node_modules/leetcode-cli/lib/plugins/solution.discuss.js:76:45
    at Plugin.plugin.getProblem (/usr/local/lib/node_modules/leetcode-cli/lib/plugins/cache.js:33:12)
    at Plugin.plugin.getProblem (/usr/local/lib/node_modules/leetcode-cli/lib/plugins/solution.discuss.js:75:15)
    at /usr/local/lib/node_modules/leetcode-cli/lib/core.js:95:15
    at /usr/local/lib/node_modules/leetcode-cli/lib/plugins/company.js:1183:12
    at Plugin.plugin.getProblems (/usr/local/lib/node_modules/leetcode-cli/lib/plugins/cache.js:16:12)
    at Plugin.plugin.getProblems (/usr/local/lib/node_modules/leetcode-cli/lib/plugins/company.js:1171:15)
    at Plugin.core.getProblem (/usr/local/lib/node_modules/leetcode-cli/lib/core.js:87:8)

edit: I'm unsure of the root cause of the issue, but it seems to be intermittent.

In my case, clearing the locally cached problem fixed the fact that there was no templates property on the cached object.

i.e. rm ~/.lc/leetcode/cache/<your_problem>.json

e.g. rm ~/.lc/leetcode/cache/635.design-log-storage-system.algorithms.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants