web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Intermittent liquid er...
Power Pages
Unanswered

Intermittent liquid error: Exception has been thrown by the target of an invocation

(0) ShareShare
ReportReport
Posted on by

Hi all,

 

We have a anonymous search page that is getting intermittent liquid errors:

 

- Liquid error: Exception has been thrown by the target of an invocation.

 

The search page does a search on knowledge articles based on the query string parameter "q" that is passed in.

We have found that:

- Sometimes the error appears for some users and not others.

- Restarting the website resolves this error - so we are resorting to restarting the website everyday. Also clearing the portal cache sometimes works.

 

The web template liquid code looks something like below (I have added the full code in the attachments).

 

 

 

{% assign query = request.params['q'] %}

{% assign validQuery = true %}

{% if query and query != "" %}
 {% if query startswith '*' or query startswith '?' %}
 {% assign validQuery = false %}
 {% else %}
 {% searchindex query: query, page: 1, page_size: 500, logical_names: 'knowledgearticle', filter:'+myorg_knowledgearticlesubtype:Article && -isinternal:Yes' %}
 {% assign searchResults = searchindex %}
 {% endsearchindex %}
 {% endif %}
{% endif %}

<script>
 var searchResults = new Array;
 var filteredResults = new Array;
 var displayResults = new Array;
 var relatedAwards = new Array;
 var activePage = 1;
 var lastPage = 1;

 {% if searchResults.results.size > 0 %}
 {% for result in searchResults.results %}
 searchResults.push(
 {
 title: `{{ result.title | escape }}`,
 krn: `{{ result.entity.myorg_krnnumber }}`,
 guid: `{{ result.entity.knowledgearticleid }}`,
 subject: `{{ result.entity.myorg_subjecttextonlyforsearch }}`,
 industry: '{{ result.entity.myorg_industrytextonlyforsearch }}',
 award: []
 }
 );
 {% endfor %}
 {% endif %}

...
...
...
</script>

 

 

 

Categories:
I have the same question (0)
  • oliver.rodrigues Profile Picture
    9,457 Most Valuable Professional on at

    I find strange that this could be intermittent.. is there any chance it happens always when you querying using a specific filter criteria?

    I would try to replicate here, to see if there is one specific scenario where it always happens.. then I would start reducing/commenting out the liquid code to see which one is causing the issue

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
rezarizvii Profile Picture

rezarizvii 71

#2
DP_Prabh Profile Picture

DP_Prabh 36

#3
oliver.rodrigues Profile Picture

oliver.rodrigues 32 Most Valuable Professional

Last 30 days Overall leaderboard