Assertion failure

Hi,
I have been receiving a lot of error emails since I first installed 3.6RC2. I never really could identify what generated it. This time for example I just added some pages with some content, and a picture:



MySource Error

File : [SYSTEM_ROOT]/core/include/assertions.inc

Line : 504



[ASSERT EXCEPTION] [string] "0" is not a valid asset ID (LINE 789 IN [SYSTEM_ROOT]/core/include/asset_manager.inc) [SYS0270]



I have attached the rest of the trace.



Any clue about what may be going wrong?

Cheers.
assert_trace.txt (1.9 KB)

Do you get the same error from a page with no content in it at all?

Check your HTML source – looks like there might be an empty anchor tag somewhere (i.e. <a href=""></a>). When Matrix tries to parse the URL to see if its an internal asset, it usually generates that error.

[quote]Check your HTML source – looks like there might be an empty anchor tag somewhere (i.e. <a href=""></a>). When Matrix tries to parse the URL to see if its an internal asset, it usually generates that error.
[right][post=“6760”]<{POST_SNAPBACK}>[/post][/right][/quote]

The only place I’ve got an empty <a href=""></a> is in my design. I have the following:



<a href="<MySource_PRINT id_name=‘contactUs’ value=‘url’ />">Contact us</a>



And left it uncustomised. However I don’t think that’s it.

To answer Greg’s question: i don’t think a page with no content generates the error.



I can reproduce it very consistently by adding a image in the wysiwyg content. The picture doesn’t have a Web path (isn’t in the Media folder and doesn’t sit under a site actually). Is that why?

[quote]The only place I’ve got an empty <a href=""></a> is in  my design. I have the following:


<a href="<MySource_PRINT id_name=‘contactUs’ value=‘url’ />">Contact us</a>



And left it uncustomised. However I don’t think that’s it.

To answer Greg’s question: i don’t think a page with no content generates the error.



I can reproduce it very consistently by adding a image in the wysiwyg content. The picture doesn’t have a Web path (isn’t in the Media folder and doesn’t sit under a site actually). Is that why?

[right][post=“6762”]<{POST_SNAPBACK}>[/post][/right][/quote]



It happens when a link to an asset in the page contents is invalid - If you view source on the page you might see something like <a href="./?a="></a> or possibly turning the essential part ./?a= into it’s html entities.



Run a links report (link report asset) across sections of your site and find out exactly where your links are breaking. I reckon if your getting a few of them chances are you’ve got a few pages with broken asset links (either in <a> tags or <img> tags). If they are in <img> tags then you might need to manually check the pages with images.



Edit: Just noticed that last part of your post. How are you adding the images so you can consistently get this error?

[quote]Edit: Just noticed that last part of your post. How are you adding the images so you can consistently get this error?
[right][post=“6763”]<{POST_SNAPBACK}>[/post][/right][/quote]

I’m logged in a root.

I have folder with non-live images.

I have a site on the same level as the folder.

In the site I have a std page.

I go to edit content, click on the insert image in the WYSIWYG and choose an image from the folder.

I press ok in the image popup and commit the page content.

Bang! Email is received with assertion failure line 504.

Matrix will not be able to serve images that don't have a URL. You will need to move the images folder into a location that has a URL.

[quote]Matrix will not be able to serve images that don’t have a URL. You will need to move the images folder into a location that has a URL.
[right][post=“6767”]<{POST_SNAPBACK}>[/post][/right][/quote]



Cool, I’ll make sure the pics have a URL then.

Just a note though: it seems to serve them (with url: ./?a=xx).

Yep, using the assetid will serve any asset without requiring a URL - but you shouldnt use that unless there is no alternative. The only place it gets used that I can think of is for previewing file/image assets in the backend.