Hello Sitecore Folks
Recently while adding a datasource query in drop link i have faced a Error of Invalid lookup source in Sitecore . it was throwing error “End of string expected at position 50″ while using query : ” itempath/*[@@templatename=’Slide’]”.
I checked following things to troubleshoot the issue:
- If Datasource location specified in the query exists or not, and it exists.
- If Datasource template is defined in query exists or not , and it was there.
- If Datasource template is defined in query have same casing or not , and it was same.
- Following was the error coming at that field.

It turns out Sitecore doesn’t like hyphens “-” in query path, and few other which includes:
- If you query contains keyword “and“
- If query contains keyword “or“
- If query contains hyphen “–“
In my case when i checked the query and it contains keyword “–“, which was basically failing and giving me error .
Solution
In order to fix this issue we can add escape character “#” before and after of the items that contains any of these keywords or hyphen “-“, so, for example:
Before : query:/sitecore/content/Horizontal/Modal Pop-Up Folder//*[@@templatename='Slide']
After :query:/sitecore/content/Horizontal/#Modal Pop-Up Folder#//*[@@templatename='Slide']
After making this change, the issue was fixed.
I hope this helps somebody.
Keep coding and keep pushing the boundaries of what’s possible with Sitecore development!
Happy learning 🙂







Leave a comment