copy paste big dictionary into chrome console

26.7k Views Asked by At

what im essentially doing is

var dictionary = [ HERE I PASTE ALMOST 200k ENTRIES ]

and it throws :

Error saving setting with name: consoleHistory, value length: 8613059. Error: Failed to set the 'consoleHistory' property on 'Storage': Setting the value of 'consoleHistory' exceeded the quota.

Ten largest settings: Setting: 'consoleHistory', size: 2872834 Setting: 'previouslyViewedFiles', size: 5462 Setting: 'networkLogColumnsVisibility', size: 378 Setting: 'dataGrid-networkLog-columnWeights', size: 340 Setting: 'userAgent', size: 146 Setting: 'Inspector.drawerSplitViewState', size: 94 Setting: 'selectedAuditCategories', size: 79 Setting: 'sourcesPanelNavigatorSplitViewState', size: 65 Setting: 'sourcesPanelSplitViewState', size: 65 Setting: 'InspectorView.splitViewState', size: 42

I want to use the dictionary later to search for things and I hit the wall here.

4

There are 4 best solutions below

5
On BEST ANSWER

See https://stackoverflow.com/a/49640154/2273611 for a more recent answer.


Very outdated answer

The console history is a record of everything that is executed in the console. so every time you're entering the 200k you are appending that to the history. LocalStorage space cant be adjusted its set to 5MB, but as long as your entry is under that and you are just entering it once then this shouldn't be a problem.

You can delete the console history to free up space.
The devtools is just another window so it can be inspected and modified like any other webpage.

Open Dev Tools

  • Select More Tools > Developer Tools from the Chrome Menu.

or

  • Right-click on a page element and selecting "inspect element" in the context menu

or

  • Use Ctrl/Cmd+Shift+I

**Inspect Dev Tools window.**
  1. In another tab/window navigate to chrome://inspect/#other.
  2. Locate the page which starts with "chrome-devtools://devtools/bundled/"
  3. Click the relevant inspect link.

This will open another devtools window where you can inspect and modify the devtools.

Remove consoleHistory form LocalStorage

Navigate to the newly opened devtools window.

Unfortunately typing localStorage.removeItem('consoleHistory'); into the console doesn't work;

So you have to do it the long way.

  1. Open "Resources" panel
  2. Expand "Local Storage" either by double clicking "Local Storage" or click the arrow.
  3. Select the called "devtools://devtools" table. (As its full, it may take a while to open)
  4. locate and select the key called 'consoleHistory'
  5. Hit delete or the "X" button.

Note. This answer has been updated to apply to version 46.0.2490.86. some details my have changed since posting. Please leave a comment if this method no longer applies.

If you are using an older version of chrome and this does not work for you then there is an additional few steps you have to take before using this method. You can find them here .

you can find your version at chrome://chrome/

2
On

2018 update:

Confirmed on Version 65.0.3325.181, you can simply right-click anywhere inside the devtools console and click "Clear console history." It solved the problem for me. I ran into this issue earlier and, having never seen it before, began going through the first couple steps to TarranJones' solution.

0
On

You can be a little more surgical than the other answers here suggest. Instead of wiping out all console history (which allows for recovering previous commands with the ↑ Arrow), you can just remove the large entries that are exceeding the quota.

  1. Open up your regular dev tools

  2. Open the dev tools inspector (Ctrl + Shift + I with dev tools in focus)

  3. Grab the consoleHistory from localStorage, remove the large entries, and replace with the new value

    var currentHistory = JSON.parse(localStorage.getItem("consoleHistory"))
    var filteredHistory = currentHistory.filter(el => el.length < 2000)
    localStorage.setItem("consoleHistory", JSON.stringify(filteredHistory, null, 0))
    
0
On

I too ran into this issue (needing to clear consoleHistory) when I maxed out its capacity. In this case clicking on chrome-devtools://de... in inspector would crash the window and trying to delete via localStorage.clear() or localStorage.removeItem() would timeout or be otherwise unsuccessful.

My solution was deleting the localStorage data files themselves.

On a mac, the instructions are:

cd ~/Library/Application\ Support/Google/Chrome/Default/Local\ Storage
rm chrome-devtools_devtools_0.localstorage
rm chrome-devtools_devtools_0.localstorage-journal

A quick google search suggests on Windows it's %LocalAppData%\Google\Chrome\User Data\Default\Local Storage, but you may need to double check.