locked
Content Search Web Part - Result Preview Says "Invalid Request" RRS feed

  • Question

  • This behavior seems to be occurring in both our test and production farms.

    ULS logs indicate the following entry:

    Exception occured in scope Microsoft.Office.Server.Search.Query.SearchExecutor.ExecuteQueries. Exception=Microsoft.SharePoint.Client.InvalidClientQueryException: Invalid request.    
     at Microsoft.SharePoint.Client.DataConverter.GetObject[T](XmlNode node, ProxyContext proxyContext)    
     at Microsoft.SharePoint.Client.DataConverter.GetObjectArray[T](XmlNode node, ProxyContext proxyContext)    
     at Microsoft.Office.Server.Search.Query.SearchExecutorServerStub.ExecuteQueries_MethodProxy(SearchExecutor target, XmlNodeList xmlargs, ProxyContext proxyContext)    
     at Microsoft.Office.Server.Search.Query.SearchExecutorServerStub.InvokeMethod(Object target, String methodName, XmlNodeList xmlargs, ProxyContext proxyContext, Boolean& isVoid)    
     at Microsoft.SharePoint.Client.ServerStub.InvokeMethodWithMonitoredScope(Object target, String methodName, XmlNodeList args, ProxyContext proxyContext, Boolean& isVoid)

    I have used very simple queries, to see if it's KQL error on our part, such as ContentType:"CType Name"

    When we use developer dashboard I can see the XML for the search request which the CSOM is dispatching however, I believe this to be completely out of the box.

    Do you have any suggestions as to why the request may be considered invalid and what diagnostics could be run to better isolate why this OOB feature is not working?

    We are using Enterprise SP2013 On Prem.

    thanks

    Wednesday, March 5, 2014 4:21 PM

Answers

  • We have solved the issue.

    On certain publishing pages we had discovered that base SharePoint JS files did not consistently load in time to allow the ClientContext to be used in our own JS files.  

    We used the following block of JS in a .ready() handler.

    var scriptbase = _spPageContextInfo.webAbsoluteUrl + "/_layouts/15/";
        $.getScript(scriptbase + "SP.Runtime.js",
            function () {
                $.getScript(scriptbase + "SP.js", function () {
                });
                $.getScript(scriptbase + "SP.init.js", function () {
                });
    
            });

    It was this forced-addition of the  SharePoint scripts which cause the errors in the search web parts.

    We are refactoring the code to use the following pattern and so ensure that the SP libraries are loaded before the social code we needed in our branding package 

    SP.SOD.executeFunc('sp.js', 'SP.ClientContext', LikeWrapper);
    

    Thank you to both Linda and Aries!

    Friday, March 7, 2014 7:24 PM

All replies

  • Hi,

    According to your post, my understanding is that you got "Invalid Request" error when using Content Search Web Part.

    I recommend to use Get-SPEnterpriseSearchStatus to check whether the Index Component and the Partition is degraded.

    If so, please reset index reset and full crawl of all my content sources..

    Here is a similar blog for your reference:

    http://www.thesysadminhimself.com/2013/08/sharepoint-search-index-partition-degraded.html

    Best Regards,

    Linda Li


    Linda Li
    TechNet Community Support

    Thursday, March 6, 2014 6:42 AM
  • Hi Linda, the powershell command did not yield a degraded index indication.

    We did reset and rebuild the index for good measure.

    It had no effect.

    Do you know if the trace logs, perhaps if verbose were to be enabled, would yield more in-depth troubleshooting clues? Such as schema errors from the web part itself?  

    Another interesting tidbit, in the PRD environment, the web part will correctly show a preview the first time only, any change in the web part settings (triggering a preview refresh) yields the invalid request message as well. 


    Here is the result JSON (fragment) from the initial request... the UI says "This query returned no results." however, there are results in the JSON response.. that is puzzling.

    Here is a screencap of a comparison of the request XML.  The working XML request is on the left-side.

    You can see in the invalid example it refers to a typeID which matches the GUID of  this CSOM class: QueryPropertyValue class whereas the working example refers to "Dictionary"

    The other difference appears to be in the property values themselves, on the working example they are named by name... Bool, String, etc..., whereas on the invalid request they have a dollar-sign notation.  Is this normal for this web part?

    Thursday, March 6, 2014 6:04 PM
  • Hi,

    Thank you for your question. I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience. Thank you for your understanding and support.

    Thanks,

    Linda Li


    Linda Li
    TechNet Community Support

    Friday, March 7, 2014 1:16 AM
  • Hi,

    after try to discuss your issue, seems we are lost in someway. please help to elaborate the situation,

    what we can get at this point,

    1. you Content Search Web Part - Result Preview Says "Invalid Request".

    2. you search KQL, ContentType:"CType Name", then the result is not appear

    3. there is customization in the webpart, as shown in the screen capture

    please help us to understand, the dollarsign parameter is that caused by the customization,

    please let us know how to reproduce the issue in order for us to know better picture.

    if you tried to run jsonp code from another domain to search SPS 2013, this may not be possible, because SPS2013 REST service does not support JSONP


    Regards,
    Aries
    Microsoft Online Community Support


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Friday, March 7, 2014 10:37 AM
  • Aries,

    Here is a description of what I see.

    1) This is the out of the box (non-customized) CSWP

    2) Upon clicking the "Change Query" button on the toolpart the dialog window opens.  The Search Result Preview says "This query returned no results" but as per the JSON response above, it appears that there is "ResultTables" present in the response. Occasionally, a preview-result does show up but this is not consistent.  The JSON response seems to be identical.

    Initial response - shows "Query returned no results" however, I see results in the JSON below. I have replaced our hostname w/ intranet.contoso.com

    [
    {
    "SchemaVersion":"15.0.0.0","LibraryVersion":"15.0.4505.1001","ErrorInfo":null,"TraceCorrelationId":"24f57a9c-28de-4074-debb-1340df16b8ab"
    },1,{
    "IsNull":false
    },4,{
    "IsNull":false
    },12,{
    "IsNull":false
    },16,{
    "IsNull":false
    },24,{
    "IsNull":false
    },38,{
    "IsNull":false
    },43,{
    "c856bd07-9a44-4bf4-a32c-e049d1d03390Default":{
    "_ObjectType_":"Microsoft.SharePoint.Client.Search.Query.ResultTableCollection","ElapsedTime":62,"Properties":{
    "RowLimit":10,"SourceId":"\/Guid(8413cd39-2156-4e00-b54d-11efd9abdb89)\/","EnableStacking":true,"piPageImpression":"327337_1754_1033","SerializedQuery":"<Query Culture=\"en-US\" EnableStemming=\"True\" EnablePhonetic=\"False\" EnableNicknames=\"False\" IgnoreAllNoiseQuery=\"True\" SummaryLength=\"180\" MaxSnippetLength=\"180\" DesiredSnippetLength=\"90\" KeywordInclusion=\"0\" QueryText=\"\" QueryTemplate=\"ContentType:&quot;Custom Announcement&quot; path:&quot;http:\u002f\u002fintranet.contoso.com\u002fnews&quot;\" TrimDuplicates=\"False\" Site=\"566718d5-1e74-453c-ac54-6e636def6f91\" Web=\"83df59b4-8cac-48f4-81b3-c3b95cfacc0b\" KeywordType=\"True\" HiddenConstraints=\"\" \u002f>"
    },"QueryErrors":null,"QueryId":"1060b39a-2f92-4313-b192-4c9badd15812","SpellingSuggestion":"","TriggeredRules":[
    
    ],"ResultTables":[
    {
    "_ObjectType_":"Microsoft.SharePoint.Client.Search.Query.ResultTable","GroupTemplateId":null,"ItemTemplateId":null,"Properties":{
    "GenerationId":9223372036854775806,"ExecutionTimeMs":31,"QueryModification":"ContentType:\"Custom Announcement\" path:\"http:\u002f\u002fintranet.contoso.com\u002fnews\" -ContentClass=urn:content-class:SPSPeople","RenderTemplateId":"~sitecollection\u002f_catalogs\u002fmasterpage\u002fDisplay Templates\u002fSearch\u002fGroup_Default.js","StartRecord":0,"piPageImpressionBlockType":2
    },"QueryId":"1060b39a-2f92-4313-b192-4c9badd15812","QueryRuleId":"00000000-0000-0000-0000-000000000000","ResultRows":[
    {
    "Rank":0,"DocId":1348,"Path":"http:\u002f\u002fintranet.contoso.com\u002fnews\u002fPages\u002fU-S--employees.aspx","Title":"U.S. employees: March 15th deadline for 2013 Health Care Flexible Spending Account (FSA)","OriginalPath":"http:\u002f\u002fintranet.contoso.com\u002fnews\u002fPages\u002fU-S--employees.aspx","FileType":"html","SecondaryFileExtension":"aspx","Author":"Dennis Lanthier","Size":100366,"Description":null,"EditorOWSUSER":"dennis_lanthier@contoso.com | Dennis Lanthier | 693A30232E777C7463706C5C64656E6E69735F6C616E7468696572 i:0#.w|tcpl\\dennis_lanthier","LastModifiedTime":"\/Date(1394039237000)\/","CollapsingStatus":0,"HitHighlightedSummary":null,"HitHighlightedProperties":null,"FileExtension":"aspx","ViewsLifeTime":null,"ParentLink":"http:\u002f\u002fintranet.contoso.com\u002fnews\u002fPages\u002fForms\u002fAllItems.aspx","ViewsRecent":null,"IsContainer":false,"DisplayAuthor":"Dennis Lanthier","docaclmeta":null,"ResultTypeIdList":"16","PartitionId":"\/Guid(0c37852b-34d0-418e-91c6-2ac25af4be5b)\/","UrlZone":0,"AAMEnabledManagedProperties":"AttachmentURI;deeplinks;DefaultEncodingURL;ExternalMediaURL;HierarchyUrl;OrgParentUrls;OrgUrls;OriginalPath;ParentLink;Path;PictureThumbnailURL;PictureURL;PublishingImage;recommendedfor;ServerRedirectedEmbedURL;ServerRedirectedPreviewURL;ServerRedirectedURL;SiteLogo;SitePath;SPSiteURL;UserEncodingURL","ResultTypeId":16,"RenderTemplateId":"~sitecollection\u002f_catalogs\u002fmasterpage\u002fDisplay Templates\u002fSearch\u002fItem_WebPage.js","piSearchResultId":"0_1","QueryRuleId":"\/Guid(00000000-0000-0000-0000-000000000000)\/"
    },{
    "Rank":0,"DocId":1392,"Path":"http:\u002f\u002fintranet.contoso.com\u002fnews\u002fPages\u002fCelebrate-International-Women\u2019s-Day-on-Thurs--Mar--6.aspx","Title":"Celebrate International Women\u2019s Day on Thursday, March 6th ","OriginalPath":"http:\u002f\u002fintranet.contoso.com\u002fnews\u002fPages\u002fCelebrate-International-Women\u2019s-Day-on-Thurs--Mar--6.aspx","FileType":"html","SecondaryFileExtension":"aspx","Author":"Cassie Dubetz;Jennifer Torres","Size":103770,"Description":null,"EditorOWSUSER":"jennifer_torres@contoso.com | Jennifer Torres | 693A30232E777C7463706C5C6A656E6E696665725F746F72726573 i:0#.w|tcpl\\jennifer_torres","LastModifiedTime":"\/Date(1394070849000)\/","CollapsingStatus":0,"HitHighlightedSummary":null,"HitHighlightedProperties":null,"FileExtension":"aspx","ViewsLifeTime":null,"ParentLink":"http:\u002f\u002fintranet.contoso.com\u002fnews\u002fPages\u002fForms\u002fAllItems.aspx","ViewsRecent":null,"IsContainer":false,"DisplayAuthor":"Cassie Dubetz;Jennifer Torres","docaclmeta":null,"ResultTypeIdList":"16","PartitionId":"\/Guid(0c37852b-34d0-418e-91c6-2ac25af4be5b)\/","UrlZone":0,"AAMEnabledManagedProperties":"AttachmentURI;deeplinks;DefaultEncodingURL;ExternalMediaURL;HierarchyUrl;OrgParentUrls;OrgUrls;OriginalPath;ParentLink;Path;PictureThumbnailURL;PictureURL;PublishingImage;recommendedfor;ServerRedirectedEmbedURL;ServerRedirectedPreviewURL;ServerRedirectedURL;SiteLogo;SitePath;SPSiteURL;UserEncodingURL","ResultTypeId":16,"RenderTemplateId":"~sitecollection\u002f_catalogs\u002fmasterpage\u002fDisplay Templates\u002fSearch\u002fItem_WebPage.js","piSearchResultId":"1_1","QueryRuleId":"\/Guid(00000000-0000-0000-0000-000000000000)\/"
    },{
    
    ContentType:"Custom Announcement" path:"http://intranet.contoso.com/news"

    This is the  KQL. (above)

    Next, we immediately click "Test query" without modifying the KQL. We send an XML request using the web part however, in that case, the XML variables are replaced with the $-syntax, this occurred within the web part through no effort of ours.  The behavior shows "Invalid Request"

    Can you explain what you mean by "There is customization in the web part"?  We have used the out of the box web part.

    Any subsequent query modification in the query-builder dialog-window causes the $-syntax.  When i illustrated the comparisons of the XML-request above the only difference in between the two requests is that the left-side is created by the initial-load of the QueryBuilder dialog and the right-side is created when we click "Test query" (immediately after) in the Advanced Mode screen.

    We do have a custom master page and I will try to revert back as close as possible to vanilla SharePoint and test.  But to address your earlier point, no customization to the Content By Search Web part has been used.

    Here is the full initial valid request

    <Request xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009" SchemaVersion="15.0.0.0" LibraryVersion="15.0.0.0" ApplicationName="Javascript Library">
    	<Actions>
    		<ObjectPath Id="1" ObjectPathId="0" />
    		<SetProperty Id="2" ObjectPathId="0" Name="QueryTemplate">
    			<Parameter Type="String">ContentType:"Custom Announcement" path:"http://intranet.contoso.com/news"</Parameter>
    		</SetProperty>
    		<ObjectPath Id="4" ObjectPathId="3" />
    		<Method Name="Add" Id="5" ObjectPathId="3">
    			<Parameters>
    				<Parameter Type="String">NewsPublishingDate</Parameter>
    				<Parameter Type="Number">1</Parameter>
    			</Parameters>
    		</Method>
    		<SetProperty Id="6" ObjectPathId="0" Name="RowsPerPage">
    			<Parameter Type="Number">10</Parameter>
    		</SetProperty>
    		<SetProperty Id="7" ObjectPathId="0" Name="RowLimit">
    			<Parameter Type="Number">10</Parameter>
    		</SetProperty>
    		<SetProperty Id="8" ObjectPathId="0" Name="TotalRowsExactMinimum">
    			<Parameter Type="Number">11</Parameter>
    		</SetProperty>
    		<SetProperty Id="9" ObjectPathId="0" Name="SourceId">
    			<Parameter Type="Guid">{8413cd39-2156-4e00-b54d-11efd9abdb89}</Parameter>
    		</SetProperty>
    		<SetProperty Id="10" ObjectPathId="0" Name="Refiners">
    			<Parameter Type="String">BaseOfficeLocation(filter=7/0/*),CombinedUserProfileNames(filter=7/0/*),companies(filter=7/0/*),contentclass(filter=7/0/*),ContentType(filter=7/0/*),ContentTypeId(filter=7/0/*),Department(filter=7/0/*),DisplayAuthor(filter=7/0/*),DMSDocAuthor(filter=7/0/*),FileExtension(filter=7/0/*),FileType(filter=7/0/*),HostingPartition(filter=7/0/*),JobTitle(filter=7/0/*),languages(filter=7/0/*),Location(filter=7/0/*),ManagedProperties(filter=7/0/*),NewsExternalNewsSource(filter=7/0/*),owsmetadatafacetinfo(filter=7/0/*),owstaxidmetadataalltagsinfo(filter=7/0/*),owstaxIdProductCatalogItemCategory(filter=7/0/L*),People(filter=7/0/*),PeopleInMedia(filter=7/0/*),PeopleKeywords(filter=7/0/*),PostAuthor(filter=7/0/*),RefinableString00(filter=7/0/*),RefinableString01(filter=7/0/*),RefinableString02(filter=7/0/*),RefinableString03(filter=7/0/*),RefinableString04(filter=7/0/*),RefinableString05(filter=7/0/*),RefinableString06(filter=7/0/*),RefinableString07(filter=7/0/*),RefinableString08(filter=7/0/*),RefinableString09(filter=7/0/*),RefinableString10(filter=7/0/*),RefinableString11(filter=7/0/*),RefinableString12(filter=7/0/*),RefinableString13(filter=7/0/*),RefinableString14(filter=7/0/*),RefinableString15(filter=7/0/*),RefinableString16(filter=7/0/*),RefinableString17(filter=7/0/*),RefinableString18(filter=7/0/*),RefinableString19(filter=7/0/*),RefinableString20(filter=7/0/*),RefinableString21(filter=7/0/*),RefinableString22(filter=7/0/*),RefinableString23(filter=7/0/*),RefinableString24(filter=7/0/*),RefinableString25(filter=7/0/*),RefinableString26(filter=7/0/*),RefinableString27(filter=7/0/*),RefinableString28(filter=7/0/*),RefinableString29(filter=7/0/*),RefinableString30(filter=7/0/*),RefinableString31(filter=7/0/*),RefinableString32(filter=7/0/*),RefinableString33(filter=7/0/*),RefinableString34(filter=7/0/*),RefinableString35(filter=7/0/*),RefinableString36(filter=7/0/*),RefinableString37(filter=7/0/*),RefinableString38(filter=7/0/*),RefinableString39(filter=7/0/*),RefinableString40(filter=7/0/*),RefinableString41(filter=7/0/*),RefinableString42(filter=7/0/*),RefinableString43(filter=7/0/*),RefinableString44(filter=7/0/*),RefinableString45(filter=7/0/*),RefinableString46(filter=7/0/*),RefinableString47(filter=7/0/*),RefinableString48(filter=7/0/*),RefinableString49(filter=7/0/*),RefinableString50(filter=7/0/*),RefinableString51(filter=7/0/*),RefinableString52(filter=7/0/*),RefinableString53(filter=7/0/*),RefinableString54(filter=7/0/*),RefinableString55(filter=7/0/*),RefinableString56(filter=7/0/*),RefinableString57(filter=7/0/*),RefinableString58(filter=7/0/*),RefinableString59(filter=7/0/*),RefinableString60(filter=7/0/*),RefinableString61(filter=7/0/*),RefinableString62(filter=7/0/*),RefinableString63(filter=7/0/*),RefinableString64(filter=7/0/*),RefinableString65(filter=7/0/*),RefinableString66(filter=7/0/*),RefinableString67(filter=7/0/*),RefinableString68(filter=7/0/*),RefinableString69(filter=7/0/*),RefinableString70(filter=7/0/*),RefinableString71(filter=7/0/*),RefinableString72(filter=7/0/*),RefinableString73(filter=7/0/*),RefinableString74(filter=7/0/*),RefinableString75(filter=7/0/*),RefinableString76(filter=7/0/*),RefinableString77(filter=7/0/*),RefinableString78(filter=7/0/*),RefinableString79(filter=7/0/*),RefinableString80(filter=7/0/*),RefinableString81(filter=7/0/*),RefinableString82(filter=7/0/*),RefinableString83(filter=7/0/*),RefinableString84(filter=7/0/*),RefinableString85(filter=7/0/*),RefinableString86(filter=7/0/*),RefinableString87(filter=7/0/*),RefinableString88(filter=7/0/*),RefinableString89(filter=7/0/*),RefinableString90(filter=7/0/*),RefinableString91(filter=7/0/*),RefinableString92(filter=7/0/*),RefinableString93(filter=7/0/*),RefinableString94(filter=7/0/*),RefinableString95(filter=7/0/*),RefinableString96(filter=7/0/*),RefinableString97(filter=7/0/*),RefinableString98(filter=7/0/*),RefinableString99(filter=7/0/*),Responsibilities(filter=7/0/*),SharedWithInternal(filter=7/0/*),Site(filter=7/0/*),SPContentType(filter=7/0/*),SPSiteURL(filter=7/0/*),Tags(filter=7/0/*),UsageEventItemId(filter=7/0/*),WebTemplate(filter=7/0/*),WordCustomRefiner1(filter=7/0/*),WordCustomRefiner2(filter=7/0/*),WordCustomRefiner3(filter=7/0/*),WordCustomRefiner4(filter=7/0/*),WordCustomRefiner5(filter=7/0/*),WordExactCustomRefiner(filter=7/0/*),WordPartCustomRefiner1(filter=7/0/*),WordPartCustomRefiner2(filter=7/0/*),WordPartCustomRefiner3(filter=7/0/*),WordPartCustomRefiner4(filter=7/0/*),WordPartCustomRefiner5(filter=7/0/*),WordPartExactCustomRefiner(filter=7/0/*)</Parameter>
    		</SetProperty>
    		<ObjectPath Id="12" ObjectPathId="11" />
    		<Method Name="Add" Id="13" ObjectPathId="11">
    			<Parameters>
    				<Parameter Type="String">Path</Parameter>
    			</Parameters>
    		</Method>
    		<Method Name="Add" Id="14" ObjectPathId="11">
    			<Parameters>
    				<Parameter Type="String">Title</Parameter>
    			</Parameters>
    		</Method>
    		<ObjectPath Id="16" ObjectPathId="15" />
    		<Method Name="Add" Id="17" ObjectPathId="15">
    			<Parameters>
    				<Parameter Type="String">Title</Parameter>
    			</Parameters>
    		</Method>
    		<Method Name="Add" Id="18" ObjectPathId="15">
    			<Parameters>
    				<Parameter Type="String">Path</Parameter>
    			</Parameters>
    		</Method>
    		<Method Name="Add" Id="19" ObjectPathId="15">
    			<Parameters>
    				<Parameter Type="String">Author</Parameter>
    			</Parameters>
    		</Method>
    		<Method Name="Add" Id="20" ObjectPathId="15">
    			<Parameters>
    				<Parameter Type="String">SectionNames</Parameter>
    			</Parameters>
    		</Method>
    		<Method Name="Add" Id="21" ObjectPathId="15">
    			<Parameters>
    				<Parameter Type="String">SiteDescription</Parameter>
    			</Parameters>
    		</Method>
    		<SetProperty Id="22" ObjectPathId="0" Name="TrimDuplicates">
    			<Parameter Type="Boolean">false</Parameter>
    		</SetProperty>
    		<ObjectPath Id="24" ObjectPathId="23" />
    		<Method Name="SetQueryPropertyValue" Id="25" ObjectPathId="23">
    			<Parameters>
    				<Parameter Type="String">FillIn</Parameter>
    				<Parameter TypeId="{b25ba502-71d7-4ae4-a701-4ca2fb1223be}">
    					<Property Name="BoolVal" Type="Boolean">false</Property>
    					<Property Name="IntVal" Type="Number">0</Property>
    					<Property Name="QueryPropertyValueTypeIndex" Type="Number">1</Property>
    					<Property Name="StrArray" Type="Null" />
    					<Property Name="StrVal" Type="String">false</Property>
    				</Parameter>
    			</Parameters>
    		</Method>
    		<Method Name="SetQueryPropertyValue" Id="26" ObjectPathId="23">
    			<Parameters>
    				<Parameter Type="String">EnableStacking</Parameter>
    				<Parameter TypeId="{b25ba502-71d7-4ae4-a701-4ca2fb1223be}">
    					<Property Name="BoolVal" Type="Boolean">true</Property>
    					<Property Name="IntVal" Type="Number">0</Property>
    					<Property Name="QueryPropertyValueTypeIndex" Type="Number">3</Property>
    					<Property Name="StrArray" Type="Null" />
    					<Property Name="StrVal" Type="Null" />
    				</Parameter>
    			</Parameters>
    		</Method>
    		<Method Name="SetQueryPropertyValue" Id="27" ObjectPathId="23">
    			<Parameters>
    				<Parameter Type="String">TryCache</Parameter>
    				<Parameter TypeId="{b25ba502-71d7-4ae4-a701-4ca2fb1223be}">
    					<Property Name="BoolVal" Type="Boolean">true</Property>
    					<Property Name="IntVal" Type="Number">0</Property>
    					<Property Name="QueryPropertyValueTypeIndex" Type="Number">3</Property>
    					<Property Name="StrArray" Type="Null" />
    					<Property Name="StrVal" Type="Null" />
    				</Parameter>
    			</Parameters>
    		</Method>
    		<Method Name="SetQueryPropertyValue" Id="28" ObjectPathId="23">
    			<Parameters>
    				<Parameter Type="String">ListId</Parameter>
    				<Parameter TypeId="{b25ba502-71d7-4ae4-a701-4ca2fb1223be}">
    					<Property Name="BoolVal" Type="Boolean">false</Property>
    					<Property Name="IntVal" Type="Number">0</Property>
    					<Property Name="QueryPropertyValueTypeIndex" Type="Number">1</Property>
    					<Property Name="StrArray" Type="Null" />
    					<Property Name="StrVal" Type="String">b9b9c3b8-92d8-4850-a3b3-fc2544b9c6c0</Property>
    				</Parameter>
    			</Parameters>
    		</Method>
    		<Method Name="SetQueryPropertyValue" Id="29" ObjectPathId="23">
    			<Parameters>
    				<Parameter Type="String">ListItemId</Parameter>
    				<Parameter TypeId="{b25ba502-71d7-4ae4-a701-4ca2fb1223be}">
    					<Property Name="BoolVal" Type="Boolean">false</Property>
    					<Property Name="IntVal" Type="Number">27</Property>
    					<Property Name="QueryPropertyValueTypeIndex" Type="Number">2</Property>
    					<Property Name="StrArray" Type="Null" />
    					<Property Name="StrVal" Type="Null" />
    				</Parameter>
    			</Parameters>
    		</Method>
    		<Method Name="SetQueryPropertyValue" Id="30" ObjectPathId="23">
    			<Parameters>
    				<Parameter Type="String">OverrideExpandedTokens</Parameter>
    				<Parameter TypeId="{b25ba502-71d7-4ae4-a701-4ca2fb1223be}">
    					<Property Name="BoolVal" Type="Boolean">true</Property>
    					<Property Name="IntVal" Type="Number">0</Property>
    					<Property Name="QueryPropertyValueTypeIndex" Type="Number">3</Property>
    					<Property Name="StrArray" Type="Null" />
    					<Property Name="StrVal" Type="Null" />
    				</Parameter>
    			</Parameters>
    		</Method>
    		<SetProperty Id="31" ObjectPathId="0" Name="ResultsUrl">
    			<Parameter Type="String">/news/Pages/Announcements.aspx</Parameter>
    		</SetProperty>
    		<SetProperty Id="32" ObjectPathId="0" Name="ClientType">
    			<Parameter Type="String">SearchWebPartConfiguration</Parameter>
    		</SetProperty>
    		<SetProperty Id="33" ObjectPathId="0" Name="EnableInterleaving">
    			<Parameter Type="Boolean">false</Parameter>
    		</SetProperty>
    		<Method Name="SetQueryPropertyValue" Id="34" ObjectPathId="23">
    			<Parameters>
    				<Parameter Type="String">QuerySession</Parameter>
    				<Parameter TypeId="{b25ba502-71d7-4ae4-a701-4ca2fb1223be}">
    					<Property Name="BoolVal" Type="Boolean">false</Property>
    					<Property Name="IntVal" Type="Number">0</Property>
    					<Property Name="QueryPropertyValueTypeIndex" Type="Number">1</Property>
    					<Property Name="StrArray" Type="Null" />
    					<Property Name="StrVal" Type="String">a5fa2e59-91c1-472e-a63d-d99d2fbf8fd0</Property>
    				</Parameter>
    			</Parameters>
    		</Method>
    		<SetProperty Id="35" ObjectPathId="0" Name="SafeQueryPropertiesTemplateUrl">
    			<Parameter Type="String">sitesearch://webroot</Parameter>
    		</SetProperty>
    		<SetProperty Id="36" ObjectPathId="0" Name="IgnoreSafeQueryPropertiesTemplateUrl">
    			<Parameter Type="Boolean">false</Parameter>
    		</SetProperty>
    		<ObjectPath Id="38" ObjectPathId="37" />
    		<ExceptionHandlingScope Id="39">
    			<TryScope Id="41">
    				<Method Name="ExecuteQueries" Id="43" ObjectPathId="37">
    					<Parameters>
    						<Parameter Type="Array">
    							<Object Type="String">ca9bfc32-2337-47bb-b973-800509d8efecDefault</Object>
    						</Parameter>
    						<Parameter Type="Array">
    							<Object ObjectPathId="0" />
    						</Parameter>
    						<Parameter Type="Boolean">true</Parameter>
    					</Parameters>
    				</Method>
    			</TryScope>
    			<CatchScope Id="45" />
    		</ExceptionHandlingScope>
    	</Actions>
    	<ObjectPaths>
    		<Constructor Id="0" TypeId="{80173281-fffd-47b6-9a49-312e06ff8428}" />
    		<Property Id="3" ParentId="0" Name="SortList" />
    		<Property Id="11" ParentId="0" Name="SelectProperties" />
    		<Property Id="15" ParentId="0" Name="HitHighlightedProperties" />
    		<Property Id="23" ParentId="0" Name="Properties" />
    		<Constructor Id="37" TypeId="{8d2ac302-db2f-46fe-9015-872b35f15098}" />
    	</ObjectPaths>
    </Request>

    Here is the full invalid-request which is created with the TestQuery button

    <Request xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009" SchemaVersion="15.0.0.0" LibraryVersion="15.0.0.0" ApplicationName="Javascript Library">
    	<Actions>
    		<ObjectPath Id="1" ObjectPathId="0" />
    		<SetProperty Id="2" ObjectPathId="0" Name="QueryTemplate">
    			<Parameter Type="String">ContentType:"Custom Announcement" path:"http://intranet.contoso.com/news"</Parameter>
    		</SetProperty>
    		<ObjectPath Id="4" ObjectPathId="3" />
    		<Method Name="Add" Id="5" ObjectPathId="3">
    			<Parameters>
    				<Parameter Type="String">NewsPublishingDate</Parameter>
    				<Parameter Type="Number">1</Parameter>
    			</Parameters>
    		</Method>
    		<SetProperty Id="6" ObjectPathId="0" Name="RowsPerPage">
    			<Parameter Type="Number">10</Parameter>
    		</SetProperty>
    		<SetProperty Id="7" ObjectPathId="0" Name="RowLimit">
    			<Parameter Type="Number">10</Parameter>
    		</SetProperty>
    		<SetProperty Id="8" ObjectPathId="0" Name="TotalRowsExactMinimum">
    			<Parameter Type="Number">11</Parameter>
    		</SetProperty>
    		<SetProperty Id="9" ObjectPathId="0" Name="SourceId">
    			<Parameter Type="Guid">{8413cd39-2156-4e00-b54d-11efd9abdb89}</Parameter>
    		</SetProperty>
    		<SetProperty Id="10" ObjectPathId="0" Name="Refiners">
    			<Parameter Type="String">BaseOfficeLocation(filter=7/0/*),CombinedUserProfileNames(filter=7/0/*),companies(filter=7/0/*),contentclass(filter=7/0/*),ContentType(filter=7/0/*),ContentTypeId(filter=7/0/*),Department(filter=7/0/*),DisplayAuthor(filter=7/0/*),DMSDocAuthor(filter=7/0/*),FileExtension(filter=7/0/*),FileType(filter=7/0/*),HostingPartition(filter=7/0/*),JobTitle(filter=7/0/*),languages(filter=7/0/*),Location(filter=7/0/*),ManagedProperties(filter=7/0/*),NewsExternalNewsSource(filter=7/0/*),owsmetadatafacetinfo(filter=7/0/*),owstaxidmetadataalltagsinfo(filter=7/0/*),owstaxIdProductCatalogItemCategory(filter=7/0/L*),People(filter=7/0/*),PeopleInMedia(filter=7/0/*),PeopleKeywords(filter=7/0/*),PostAuthor(filter=7/0/*),RefinableString00(filter=7/0/*),RefinableString01(filter=7/0/*),RefinableString02(filter=7/0/*),RefinableString03(filter=7/0/*),RefinableString04(filter=7/0/*),RefinableString05(filter=7/0/*),RefinableString06(filter=7/0/*),RefinableString07(filter=7/0/*),RefinableString08(filter=7/0/*),RefinableString09(filter=7/0/*),RefinableString10(filter=7/0/*),RefinableString11(filter=7/0/*),RefinableString12(filter=7/0/*),RefinableString13(filter=7/0/*),RefinableString14(filter=7/0/*),RefinableString15(filter=7/0/*),RefinableString16(filter=7/0/*),RefinableString17(filter=7/0/*),RefinableString18(filter=7/0/*),RefinableString19(filter=7/0/*),RefinableString20(filter=7/0/*),RefinableString21(filter=7/0/*),RefinableString22(filter=7/0/*),RefinableString23(filter=7/0/*),RefinableString24(filter=7/0/*),RefinableString25(filter=7/0/*),RefinableString26(filter=7/0/*),RefinableString27(filter=7/0/*),RefinableString28(filter=7/0/*),RefinableString29(filter=7/0/*),RefinableString30(filter=7/0/*),RefinableString31(filter=7/0/*),RefinableString32(filter=7/0/*),RefinableString33(filter=7/0/*),RefinableString34(filter=7/0/*),RefinableString35(filter=7/0/*),RefinableString36(filter=7/0/*),RefinableString37(filter=7/0/*),RefinableString38(filter=7/0/*),RefinableString39(filter=7/0/*),RefinableString40(filter=7/0/*),RefinableString41(filter=7/0/*),RefinableString42(filter=7/0/*),RefinableString43(filter=7/0/*),RefinableString44(filter=7/0/*),RefinableString45(filter=7/0/*),RefinableString46(filter=7/0/*),RefinableString47(filter=7/0/*),RefinableString48(filter=7/0/*),RefinableString49(filter=7/0/*),RefinableString50(filter=7/0/*),RefinableString51(filter=7/0/*),RefinableString52(filter=7/0/*),RefinableString53(filter=7/0/*),RefinableString54(filter=7/0/*),RefinableString55(filter=7/0/*),RefinableString56(filter=7/0/*),RefinableString57(filter=7/0/*),RefinableString58(filter=7/0/*),RefinableString59(filter=7/0/*),RefinableString60(filter=7/0/*),RefinableString61(filter=7/0/*),RefinableString62(filter=7/0/*),RefinableString63(filter=7/0/*),RefinableString64(filter=7/0/*),RefinableString65(filter=7/0/*),RefinableString66(filter=7/0/*),RefinableString67(filter=7/0/*),RefinableString68(filter=7/0/*),RefinableString69(filter=7/0/*),RefinableString70(filter=7/0/*),RefinableString71(filter=7/0/*),RefinableString72(filter=7/0/*),RefinableString73(filter=7/0/*),RefinableString74(filter=7/0/*),RefinableString75(filter=7/0/*),RefinableString76(filter=7/0/*),RefinableString77(filter=7/0/*),RefinableString78(filter=7/0/*),RefinableString79(filter=7/0/*),RefinableString80(filter=7/0/*),RefinableString81(filter=7/0/*),RefinableString82(filter=7/0/*),RefinableString83(filter=7/0/*),RefinableString84(filter=7/0/*),RefinableString85(filter=7/0/*),RefinableString86(filter=7/0/*),RefinableString87(filter=7/0/*),RefinableString88(filter=7/0/*),RefinableString89(filter=7/0/*),RefinableString90(filter=7/0/*),RefinableString91(filter=7/0/*),RefinableString92(filter=7/0/*),RefinableString93(filter=7/0/*),RefinableString94(filter=7/0/*),RefinableString95(filter=7/0/*),RefinableString96(filter=7/0/*),RefinableString97(filter=7/0/*),RefinableString98(filter=7/0/*),RefinableString99(filter=7/0/*),Responsibilities(filter=7/0/*),SharedWithInternal(filter=7/0/*),Site(filter=7/0/*),SPContentType(filter=7/0/*),SPSiteURL(filter=7/0/*),Tags(filter=7/0/*),UsageEventItemId(filter=7/0/*),WebTemplate(filter=7/0/*),WordCustomRefiner1(filter=7/0/*),WordCustomRefiner2(filter=7/0/*),WordCustomRefiner3(filter=7/0/*),WordCustomRefiner4(filter=7/0/*),WordCustomRefiner5(filter=7/0/*),WordExactCustomRefiner(filter=7/0/*),WordPartCustomRefiner1(filter=7/0/*),WordPartCustomRefiner2(filter=7/0/*),WordPartCustomRefiner3(filter=7/0/*),WordPartCustomRefiner4(filter=7/0/*),WordPartCustomRefiner5(filter=7/0/*),WordPartExactCustomRefiner(filter=7/0/*)</Parameter>
    		</SetProperty>
    		<ObjectPath Id="12" ObjectPathId="11" />
    		<Method Name="Add" Id="13" ObjectPathId="11">
    			<Parameters>
    				<Parameter Type="String">Path</Parameter>
    			</Parameters>
    		</Method>
    		<Method Name="Add" Id="14" ObjectPathId="11">
    			<Parameters>
    				<Parameter Type="String">Title</Parameter>
    			</Parameters>
    		</Method>
    		<ObjectPath Id="16" ObjectPathId="15" />
    		<Method Name="Add" Id="17" ObjectPathId="15">
    			<Parameters>
    				<Parameter Type="String">Title</Parameter>
    			</Parameters>
    		</Method>
    		<Method Name="Add" Id="18" ObjectPathId="15">
    			<Parameters>
    				<Parameter Type="String">Path</Parameter>
    			</Parameters>
    		</Method>
    		<Method Name="Add" Id="19" ObjectPathId="15">
    			<Parameters>
    				<Parameter Type="String">Author</Parameter>
    			</Parameters>
    		</Method>
    		<Method Name="Add" Id="20" ObjectPathId="15">
    			<Parameters>
    				<Parameter Type="String">SectionNames</Parameter>
    			</Parameters>
    		</Method>
    		<Method Name="Add" Id="21" ObjectPathId="15">
    			<Parameters>
    				<Parameter Type="String">SiteDescription</Parameter>
    			</Parameters>
    		</Method>
    		<SetProperty Id="22" ObjectPathId="0" Name="TrimDuplicates">
    			<Parameter Type="Boolean">false</Parameter>
    		</SetProperty>
    		<ObjectPath Id="24" ObjectPathId="23" />
    		<Method Name="SetQueryPropertyValue" Id="25" ObjectPathId="23">
    			<Parameters>
    				<Parameter Type="String">FillIn</Parameter>
    				<Parameter Type="Dictionary">
    					<Property Name="$4_1" Type="String">false</Property>
    					<Property Name="$0_1" Type="Number">1</Property>
    					<Property Name="$1_1" Type="Boolean">false</Property>
    					<Property Name="$2_1" Type="Number">0</Property>
    					<Property Name="$3_1" Type="Null" />
    				</Parameter>
    			</Parameters>
    		</Method>
    		<Method Name="SetQueryPropertyValue" Id="26" ObjectPathId="23">
    			<Parameters>
    				<Parameter Type="String">EnableStacking</Parameter>
    				<Parameter Type="Dictionary">
    					<Property Name="$1_1" Type="Boolean">true</Property>
    					<Property Name="$0_1" Type="Number">3</Property>
    					<Property Name="$2_1" Type="Number">0</Property>
    					<Property Name="$3_1" Type="Null" />
    					<Property Name="$4_1" Type="Null" />
    				</Parameter>
    			</Parameters>
    		</Method>
    		<Method Name="SetQueryPropertyValue" Id="27" ObjectPathId="23">
    			<Parameters>
    				<Parameter Type="String">TryCache</Parameter>
    				<Parameter Type="Dictionary">
    					<Property Name="$1_1" Type="Boolean">true</Property>
    					<Property Name="$0_1" Type="Number">3</Property>
    					<Property Name="$2_1" Type="Number">0</Property>
    					<Property Name="$3_1" Type="Null" />
    					<Property Name="$4_1" Type="Null" />
    				</Parameter>
    			</Parameters>
    		</Method>
    		<Method Name="SetQueryPropertyValue" Id="28" ObjectPathId="23">
    			<Parameters>
    				<Parameter Type="String">ListId</Parameter>
    				<Parameter Type="Dictionary">
    					<Property Name="$4_1" Type="String">b9b9c3b8-92d8-4850-a3b3-fc2544b9c6c0</Property>
    					<Property Name="$0_1" Type="Number">1</Property>
    					<Property Name="$1_1" Type="Boolean">false</Property>
    					<Property Name="$2_1" Type="Number">0</Property>
    					<Property Name="$3_1" Type="Null" />
    				</Parameter>
    			</Parameters>
    		</Method>
    		<Method Name="SetQueryPropertyValue" Id="29" ObjectPathId="23">
    			<Parameters>
    				<Parameter Type="String">ListItemId</Parameter>
    				<Parameter Type="Dictionary">
    					<Property Name="$2_1" Type="Number">27</Property>
    					<Property Name="$0_1" Type="Number">2</Property>
    					<Property Name="$1_1" Type="Boolean">false</Property>
    					<Property Name="$3_1" Type="Null" />
    					<Property Name="$4_1" Type="Null" />
    				</Parameter>
    			</Parameters>
    		</Method>
    		<Method Name="SetQueryPropertyValue" Id="30" ObjectPathId="23">
    			<Parameters>
    				<Parameter Type="String">OverrideExpandedTokens</Parameter>
    				<Parameter Type="Dictionary">
    					<Property Name="$1_1" Type="Boolean">true</Property>
    					<Property Name="$0_1" Type="Number">3</Property>
    					<Property Name="$2_1" Type="Number">0</Property>
    					<Property Name="$3_1" Type="Null" />
    					<Property Name="$4_1" Type="Null" />
    				</Parameter>
    			</Parameters>
    		</Method>
    		<SetProperty Id="31" ObjectPathId="0" Name="ResultsUrl">
    			<Parameter Type="String">/news/Pages/Announcements.aspx</Parameter>
    		</SetProperty>
    		<SetProperty Id="32" ObjectPathId="0" Name="ClientType">
    			<Parameter Type="String">SearchWebPartConfiguration</Parameter>
    		</SetProperty>
    		<SetProperty Id="33" ObjectPathId="0" Name="EnableInterleaving">
    			<Parameter Type="Boolean">false</Parameter>
    		</SetProperty>
    		<Method Name="SetQueryPropertyValue" Id="34" ObjectPathId="23">
    			<Parameters>
    				<Parameter Type="String">QuerySession</Parameter>
    				<Parameter Type="Dictionary">
    					<Property Name="$4_1" Type="String">a5fa2e59-91c1-472e-a63d-d99d2fbf8fd0</Property>
    					<Property Name="$0_1" Type="Number">1</Property>
    					<Property Name="$1_1" Type="Boolean">false</Property>
    					<Property Name="$2_1" Type="Number">0</Property>
    					<Property Name="$3_1" Type="Null" />
    				</Parameter>
    			</Parameters>
    		</Method>
    		<SetProperty Id="35" ObjectPathId="0" Name="SafeQueryPropertiesTemplateUrl">
    			<Parameter Type="String">sitesearch://webroot</Parameter>
    		</SetProperty>
    		<SetProperty Id="36" ObjectPathId="0" Name="IgnoreSafeQueryPropertiesTemplateUrl">
    			<Parameter Type="Boolean">false</Parameter>
    		</SetProperty>
    		<ObjectPath Id="38" ObjectPathId="37" />
    		<ExceptionHandlingScope Id="39">
    			<TryScope Id="41">
    				<Method Name="ExecuteQueries" Id="43" ObjectPathId="37">
    					<Parameters>
    						<Parameter Type="Array">
    							<Object Type="String">4c78ef1c-cad2-417c-9027-9c961143713cDefault</Object>
    						</Parameter>
    						<Parameter Type="Array">
    							<Object Type="Dictionary">
    								<Property Name="$R_0" Type="Null" />
    								<Property Name="$2P_0" Type="Boolean">false</Property>
    							</Object>
    						</Parameter>
    						<Parameter Type="Boolean">true</Parameter>
    					</Parameters>
    				</Method>
    			</TryScope>
    			<CatchScope Id="45" />
    		</ExceptionHandlingScope>
    	</Actions>
    	<ObjectPaths>
    		<Constructor Id="0" TypeId="{80173281-fffd-47b6-9a49-312e06ff8428}" />
    		<Property Id="3" ParentId="0" Name="SortList" />
    		<Property Id="11" ParentId="0" Name="SelectProperties" />
    		<Property Id="15" ParentId="0" Name="HitHighlightedProperties" />
    		<Property Id="23" ParentId="0" Name="Properties" />
    		<Constructor Id="37" TypeId="{8d2ac302-db2f-46fe-9015-872b35f15098}" />
    	</ObjectPaths>
    </Request>
    Many thanks for your review.

    Friday, March 7, 2014 3:39 PM
  • We have solved the issue.

    On certain publishing pages we had discovered that base SharePoint JS files did not consistently load in time to allow the ClientContext to be used in our own JS files.  

    We used the following block of JS in a .ready() handler.

    var scriptbase = _spPageContextInfo.webAbsoluteUrl + "/_layouts/15/";
        $.getScript(scriptbase + "SP.Runtime.js",
            function () {
                $.getScript(scriptbase + "SP.js", function () {
                });
                $.getScript(scriptbase + "SP.init.js", function () {
                });
    
            });

    It was this forced-addition of the  SharePoint scripts which cause the errors in the search web parts.

    We are refactoring the code to use the following pattern and so ensure that the SP libraries are loaded before the social code we needed in our branding package 

    SP.SOD.executeFunc('sp.js', 'SP.ClientContext', LikeWrapper);
    

    Thank you to both Linda and Aries!

    Friday, March 7, 2014 7:24 PM