'Can not read properties of undefined' error when searching in code editor

There are so many issues, bugs and glitches with the VS code editor in Shopify but the search is really driving me up the wall.

Does anyone know why this keeps happening and just doesn’t work…?

Any advice on what I can do to improve this would be appreciated.

Were you able to solve this? I’m having this problem and I have no idea how to fix it.

This is an odd one! I can’t reproduce it:

Is it happening for all searches or particular search strings? Does it happen on all themes or specific ones?

I am having the same issue. It will pull results for the first character of a search, but then give “Cannot read properties of undefined (reading ‘substring’)” after typing 2 or more characters.

It is worse than ever now and literally happening for any search strings.

It will occasionally allow a whole word to be typed but I think that is more chance than actually anything else.

This issue has been present since Shopify released the code editor and you can see that others are also reporting the same issue. It is making it pretty useless as we are unable to search for anything across the theme.

I don’t know if this helps but I recorded a short gif to show you how temperamental the search is with this error.

shopify-vscode-search-error

Is it always happening with the same theme or is this across any theme? Feel free to drop a theme ID in here and I can poke at it.

@Gray-Shopify this happens in any theme and any Shopify store - it does seem to be worse in some themes compared to others but it’s hard to really gauge that as I will be developing in specific themes more than the others. All I know is that it is not isolated to just one theme.

It also differs across different themes. Like in our live theme I am getting this error searching for “OpenSan” however I can search this in a different theme and not produce the same error.

It may well be something in a theme that is causing the error but I have zero idea what that could be.

Here is the theme ID of the one I am working in if of any use though - 191633850745.

Oddly enough it does seem to be something with that specific theme. I can recreate the issue by searching for open and I can’t replicate that in a different theme. This is a great spot to debug from, thank you!

Okay so long as this helps - I am pretty sure I’ve experienced this search issue in fresh versions of the Dawn theme as well before. It definitely happens a lot in multiple stores/themes, hah.

Let me know if I can do anything or provide anything else that helps.