Skip Navigation

[Resolved] Fatal error: Uncaught InvalidArgumentException: First argument is not a post.

This thread is resolved. Here is a description of the problem and solution.

Problem:
When saving field groups you see an error:

Fatal error: Uncaught InvalidArgumentException in .../types/vendor/toolset/toolset-common/inc/m2m/relationship/query/condition/type.php on line 28
–( ! ) InvalidArgumentException: in .../types/vendor/toolset/toolset-common/inc/m2m/relationship/query/condition/type.php on line 28

Solution:
Update to the latest Toolset

This support ticket is created 6 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 15 replies, has 3 voices.

Last updated by jacka-4 6 years, 1 month ago.

Assisted by: Beda.

Author
Posts
#1116701

I am trying to: Work on my Posts and Pages

Link to a page where the issue can be seen: hidden link

I expected to see: My Page admin to work on

Instead, I got:
Fatal error: Uncaught InvalidArgumentException: First argument is not a post. in ....communitytv.ie/wp-content/plugins/types/vendor/toolset/toolset-common/inc/autoloaded/field/group.php:60 Stack trace: #0 ....communitytv.ie/wp-content/plugins/types/vendor/toolset/toolset-common/inc/autoloaded/field/group/post.php(41): Toolset_Field_Group->__construct(NULL) #1 ....communitytv.ie/wp-content/plugins/types/vendor/toolset/types/embedded/includes/fields-post.php(158): Toolset_Field_Group_Post->__construct(NULL) #2 /home/z5n6o7r4....communitytv.ie/wp-content/plugins/types/vendor/toolset/types/embedded/admin.php(107): wpcf_add_meta_boxes('page', Object(WP_Post)) #3 ....communitytv.ie/wp-includes/class-wp-hook.php(286): wpcf_admin_add_meta_boxes('page', Object(WP_Post)) #4 ....communitytv.ie/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array) #5 ....communitytv.ie/wp in ....communitytv.ie/wp-content/plugins/types/vendor/toolset/toolset-common/inc/autoloaded/field/group.php on line 60

Obviously I have taken out the first few words to disguise the Direct link.

Please do not suggest a fresh install of WP

#1116932

I see the error on your page and the code tells this is because a Field Group is called, which is no field group (no post) and hence it throws an exception.
It means as well, it should theoretically not be possible to happen.

I have a few questions in regard:
- when/after what did this start?
- did you try to enable another theme or disable other plugins?

I will try that locally once I have the duplicate downloaded.
It would be interesting to know if this was due to an update, or similar.

#1116946

Humm, that dropbox link is invalid.

I'm trying to grab a copy myself.

#1116960

Ok, this doesn't work.

Please can you send me either of:
- an exported ZIP of the database + Compressed FTP Files of the install
- a working Duplicator as shown here
https://toolset.com/faq/provide-supporters-copy-site/
- Steps to replicate the issue

I will need to locally confirm if this happens with:
- no other plugins
- another theme
- fresh plugin copies

These tests can be made online as well, after a valid backup of the site you could try to solve the issue with the above steps to see if it's a compatibility problem.

I also would suggest re-save all Post Types and Field Groups if you can access them.

Locally I cannot replicate such an issue and it was not possible to grab a proper copy myself on the site

#1117103

Beda

Thank you for your reply......I have tried the following.

I tried another Theme - same error
I turned off the most recent installed plugins - same error
I tried a fresh install of Types - same error

This is a multisite and It is the main website....I cannot do anything without affecting the other websites on the server.

Siteground whcih is my Host does daily backups of my websites so you can try anything without fear of deleting anything important.

If you still need a backup then indictae to me as soon as you can. I am on a deadline and see you are nearly finished work.

What I am doing is quiet complex ...I have created the main website on the multisite and tried styling the pages with Toolset and Visual Composer when this issue happened. I cannot get in to edit my posts or types and so I am stuck.

If I cannot get this working by tomorrow I will have to look for a refund and go back to ACF.....Sunday is my deadline!

#1117170

Hello again

I have the two files (database & files) Zips ready to send you but there is no option to make this private??

I do not want to go through the FTP settings etc for opening a new ticket so...

Can you open this or send me an email I can mail you the two google Drive Zips???

#1117595

Any progress on this??

I really cannot wait any longer than end of today?

#1117600

I cannot fix this until Sunday if is a BUG in Toolset which I cannot yet confirm, I cannot see this error,

The private replies are active only once each reply, so I activated this again.

This BUG is not reported by anyone else yet, so I suspect it is an exception.

Please be sure to have the latest available versions of the Plugin and that it happens with Just Elementor and Toolset, which I cannot confirm locally and many other users neither.
But eventually, this is a server problem, a PHP version problem, or anything else that went wrong in the specific Group of Posts.
I will find out, but this requires more time than a day, and my weekend starts until Tuesday.

I can leave this unassigned so Christian tomorrow can look at it, in case I do not receive the data or cannot solve it just yet today.

With such an error a timeline, it is better (it does not help a lot to solve issues usually online) to do this locally with the duplicate if you could submit it to us.

We will need to know where and when this error will happen, on that duplicate, and will try to find why it happens and how to fix it.

I have created the main website on the multisite and tried styling the pages with Toolset and Visual Composer when this issue happened

Hence something went wrong while editing the content, not when updating or editing code.
This speaks for an issue due to the latest updates, which is fixed with the very lats update of Views - please check that this is updated and that the issue then still happens.

The last release was yesterday late.

#1117610
#1117645
Bildschirmfoto 2018-09-29 um 18.58.37.png

I cannot fix this until Sunday night for you, I am sorry.
Not even a Developer can, because they are not working now.

If you have errors with ACF, I am not sure why you refer to us, as that is not our plugin.
Or do you mean that you chose using Toolset instead of ACF?

If you need another route if this is not fixed until Sunday (which it will not), please use this form to get a refund:
https://toolset.com/buy/refund-policy/

I do not want to sound rude, this is just what are the facts, and I cannot "Lie" to you by stating I can and will fix this until the deadline you set.

Now, to the issue, I deployed the package, the problem is that the Database is customized, that is not a native WordPress database.
I cannot, for example, find any of the native WP Options table entries.
There should be site URL, etc, but the only there is is a flow_flow_db_version
As the value, it has a downloadable link, binary file

This is not how a WordPress database should look and it is not possible to deploy the package.

We would need to rebuild the native database at least to access the data from an install locally.

This error is until now not reported else and there are several reasons why this can happen, especially if the database is customized, or corrupt, I am not sure there should be binary fields in a database option.

If you require further help with this, we will need a replicable environment or a copy that we can use to replicate the issue.
We can do this on the existing package but as stated, this will require a lot of time to rebuild, as the current data is not applicable to replicate a site with.

What we can also try is if deleting, or resaving, the Fields Groups, would help, this is the only fast solution I can imagine.

Note that on the online site provided, Chrome blocks several "Unsafe Contents"
(Screenshot attached)
I am not sure what that is, but it's not the native behaviour of Toolset or WordPress.

You also have Elementor active, which was known to conflict, and that is fixed in the latest Toolset releases, which are installed.
But you also use WP Bakery Page Builder, Add-ons for Visual composers, etc.
These tools should not be used together, one Template designer should be used instead.

I also see extremely a lot of Plugins that I have found to conflict sometimes, and I cannot confirm if disabling them solves the issue.
You mention it does not, but this is the first I would try locally, and then I would try another Theme, I would try to unify the duplicated Field group "WooCommerce Views filter fields", or delete one of them, re-save the Page's Fields Group (which has 0 fields in it)

I can either do that locally or online, but online I have no access to the most of the plugins so to start to debug
Debug can be done only if the issue is present when Toolset only is active, and an eventual incompatible plugin, but not as many as currently active.

Since you have no content in those Field Groups I'd start by deleting those, after confirming the above steps don't help.
If by then this is still not solved, I'd head to the Post Type in a question and re-save those
I'd make sure the plugins of Toolset are fresh copies and not corrupt, and narrow it down piece by piece (even replacing WordPress files if needed)

It is the only way to find out what happened, as basically, the code is failing because some data expected is missed.
I assume that data is supposed to be provided by a Custom Field Group that if deleted probably will solve the issue, but not necessarily, it might be buried deeper, requiring more time to analyse, and a working copy to do so.

Also, I would try to disable Content Templates, to see if something is wrong with these.

Locally, I would need a better copy of the site, or online, I'd need access and permission to disable plugins and themes.

We are here to help with this, but to solve a problem I need to have a replicable issue, which would be eventually possible to escalate even as an exceptional issue to the Developers, but I cannot escalate an issue that I was not able to replicate locally or an online site to edit (we cannot do this)

We can however surely help to solve this with the adequate data and time needed to find and fix it.

This is currently not possible, we would need a working copy, or an online site to see the issue on a clean controlled environment

What we also can offer is online test servers where to you can deploy your (to be fixed) site, and we can have a look there if it is not possible to set up a test instance with minimal installs for you. This is free of charge, however, you will need to deploy the copy on the server, so to replicate the issue, something that with the data provided is not possible, we still would need a working copy of the site (I was not able to grab such myself either as illustrated).

#1117650

BTW, I stand corrected this was reported in past and always due to a corruption of the installs:
https://toolset.com/forums/topic/fatal-error-new-post-type-uncaught-invalidargumentexception-first-argument-is/#post-624121
https://toolset.com/forums/topic/500-internal-server-error-when-i-edit-any-post/#post-957334

I suggest to:
1. Try to replicate that on a test install (It should not happen)
2. Confirm it still happens with a fresh copy of plugins, theme and WordPress
3. Confirm it still happens even all plugins are deactivated and let us know what precise Toolset Plugin brings back the issue (without having any other plugin active)

The issues we know of with this error are due to corrupted installs, the only other case I found this error (similar) was in custom code wrongly used

Hence it seems very well a corrupted file or installs, please try the steps first.

#1117845

Beda

I do not blame you are critisise you in any way!

On the contrary I thank you most sincerly for such a detailed reply.
I greatly admire people who do their job well and that is by far the most detailed support answer I have had from anyone in 20 years in IT.

We have to move on but The fact I cannot wait any longer is not your fault at all.

Thank you very much.

#1118916

I am sorry to read this, however, I will be happy to help you anytime in case you decide to use Toolset again.

#1125134

I actually think we caught this bug, and fixed it, see here:
https://toolset.com/download/toolset-types/#changelog
https://toolset.com/forums/topic/uncaught-exception-invalidargumentexception-vendor-toolset-toolset-common-inc/#post-1124532

Posting it here in case anyone finds the report and has this issue as well with Toolset.

#1200683

I think I just hit the same bug. I just submitted a ticket.

In my case, I definitely did not do an upgrade, or install new plugins.

What I did do, is right before this showed up, I deleted a taxaonomy, a view and a form using TOOLSET. (All related to the same custom post type and custom field set), so I could start from scratch.

Then I recreated the form, autogenerated it, and went to create a brand new blank page to insert the TOOLSET shortcode for the form and BOOM.... threw the same exception.

I suspect TOOLSET is not doing proper cleanup somewhere, when you delete TOOLSET forms or something.
My exception below: (I cant create new pages anymore on the site).

[14-Feb-2019 19:02:05 UTC] PHP Fatal error: Uncaught InvalidArgumentException: First argument is not a post. in /home/hgorg/www.hanggliding.org/wp-content/plugins/types/vendor/toolset/toolset-common/inc/autoloaded/field/group.php:60
Stack trace:
#0 /home/hgorg/www.hanggliding.org/wp-content/plugins/types/vendor/toolset/toolset-common/inc/autoloaded/field/group/post.php(41): Toolset_Field_Group->__construct(NULL)
#1 /home/hgorg/www.hanggliding.org/wp-content/plugins/types/vendor/toolset/types/embedded/includes/fields-post.php(158): Toolset_Field_Group_Post->__construct(NULL)
#2 /home/hgorg/www.hanggliding.org/wp-content/plugins/types/vendor/toolset/types/embedded/admin.php(107): wpcf_add_meta_boxes('page', Object(WP_Post))
#3 /home/hgorg/www.hanggliding.org/wp-includes/class-wp-hook.php(286): wpcf_admin_add_meta_boxes('page', Object(WP_Post))
#4 /home/hgorg/www.hanggliding.org/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)
#5 /home/hgorg/www.hanggliding.org/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
#6 /home/hgorg/ww in /home/hgorg/www.hanggliding.org/wp-content/plugins/types/vendor/toolset/toolset-common/inc/autoloaded/field/group.php on line 60