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

Notifications

Announcements

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,368 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Jerry-IN Profile Picture

Jerry-IN 71

#2
Fubar Profile Picture

Fubar 62 Super User 2025 Season 2

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard