Panel error after upgrade: include failed to open stream

Hi! We just upgraded from Kirby 2.2.x to 2.5.12. Now when I try to use the panel the panel “homepage” still shows, but “options” and all the content sites show this error! The “users” site still works.

image

Funnily when I set debug = true in the config.php the entire panel works fine again.

Could you please give me a hint how I can solve this?

And more in general: can someone please explain to me the typical “call stack” in Kirby and the Panel and/or how I can debug such errors quickly myself?

Thanks!

The path looks a bit odd… what is fields/fields/fields.php? Is that a custom field youve added? Are you sure the path is correct?

I know that the path looks strange. I’m not aware that this is a field we are using. However, to drill down on this it would be helpful to catch the exception to find our in which file it occurs. How can I achieve this in the panel?

Well without knowing what is actually in fields.php, it’s hard to say.

If a custom field has been setup in fields.php, and you remove fields.php, Kirby will soon warn you when you try to use a blueprint with that field declared in it.

usually a custom field would be in /site/fields/myfieldname/myfield.php

If you know the name of the field, you can use a code editor search all the blueprints. Most will search an entire project for a string.

Ok, there was still a folder /site/fields/fields which contained some custom fields as it seems. I removed the entire folder and now everything is fine. Thanks!

Still for the sake of proper debugging it would be great if someone could explain to me how I can find out which file in the panel tried to include the missing file and thus caused the error.

Smashing :slight_smile:

Well that looks like a user created custom field rather then a downloaded plugin (i’ve been using Kirby for a few years, so I pretty much know all the plugins :slight_smile: ). Without knowing more about the project and how things hang together, it’s hard to tell you whats done it.

Generally custom fields go under site/fields/ in sub folders. 2.2 was quite sometime ago and i cant quiet remember if using a fields.php was the done thing back then.

It does bother me though that those files where there, and you’ve simply deleted them to fix it. Why where they there if they were not being used? Are you sure they are not in any blueprints?

I think the reason for the error was that in the custom field folder named “field”, Kirby expects a “field.php” file (as written in the custom field documentation).

@jimbobrjames As I took over this project only a few months back with a not so well managed file structure I believe the /site/fields/fields folder originated from a wrongful moving/copying of files which had never been resolved. (But didn’t have any functionality either)

However, I would still be curious to learn how I can use the panel and/or PHP in a way that I can trace the origin of the above file not found error. @texnixe maybe you can help?

Exactly.

Kirby/the Panel loads all folders from the /site/fields folder (and the registered fields from plugins) to create the forms (/panel/app/src/panel/form/plugins.php called in panel/app/src/panel/form.php#38) and looks for the corresponding file with the same name as the folder name. So there is nothing more to debug apart from adding the missing file/removing the folder? The error message is rather explicit after all in that it tells you that a file it’s trying to load doesn’t exist. Although the Panel could throw its own error message if it doesn’t find what it needs.

While the path looks a bit irritating, it is actually perfectly alright, provided someone really wanted to call a custom Panel field “fields” :thinking: