Cannot save article - term_id does not have a default value

Need help with the Administration of your Joomla! 4.x site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Post Reply
dfs-aviators
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Wed Apr 10, 2024 6:57 pm

Cannot save article - term_id does not have a default value

Post by dfs-aviators » Wed Apr 10, 2024 7:30 pm

Hi,

this is my first post here, so bear with me if it's not perfect.

As the subject line says, I am asking you whether you have come across that error:

'Cannot save article - term_id does not have default value'

or can suggest something about it.

As you might have guessed, it occurs every time I want to save an article.

For some background on this:
Our club and me personally have recently suffered and survived through a Joomla 3 to 4 migration.
This error remains one of the few last ones that still need to be solved.

At first I was ignoring it because it didn't seem to affect the ability to actually have the changes saved.
In fact, it saves it and shows the error still. So worse things can happen, right?

But here comes the catch, when I try to create a new article, it cannot be found (at least in the backend)
After more in depth research on this topic, I found this: https://docs.joomla.org/J4.x:Assorted_I ... in_backend
Here the author describes a (pretty heavy-handed imho) SQL Query Fix - which actually also worked out to my favor and made the articles re-appear. But of course, this only fixes the situation right now, but does not address the root cause.

Still, it got me onto the track of thinking that the whole 'term_id' issue is at the core of it.

Also I did some studying on the actual use of the 'term_id' within the DB structures of J4, and it turns out that the finder_terms table seems to rely on it.
Then I tried the most logical thing which is to manually set the 'term_id' default value to something. But also this did not change it.

But to be honest, I am shooting in the dark here, I have no idea why such a table would even be accessed when it comes time to save an article.

Nor am I 100% sure that the whole 'term_id' error is causing the 'no visibility of newly created articles in the backend' phenomenon.
Maybe those two things might be totally unrelated (?)

As you might be able to tell, I am at my wit's end here.

So any idea, suggestion or remark on the topic would be highly appreciated, thanks in advance!

EDIT: I tried to have the debug console in the browser log the http requests etc. during save but that did not yield any useful information.
Also setting the logging to ALL in Joomla and also activating the PHP error message log from my provider did unfortunately not log anything related and of use in this regard.

User avatar
pe7er
Joomla! Master
Joomla! Master
Posts: 25057
Joined: Thu Aug 18, 2005 8:55 pm
Location: Nijmegen, Netherlands
Contact:

Re: Cannot save article - term_id does not have a default value

Post by pe7er » Thu Apr 11, 2024 5:55 am

Welcome to Joomla forum!

The issue that you described, sounds like a database issue indeed.

With such an issue, I would compare the database structure of your website with a working Joomla 4 database of a newly installed website.

You can compare the table structure manually, or create a mysql export of the structure from both websites and compare it with a diff tool (e.g. https://meldmerge.org/).
Kind Regards,
Peter Martin, Global Moderator
Company website: https://db8.nl/en/ - Joomla specialist, Nijmegen, Netherlands
The best website: https://the-best-website.com

dfs-aviators
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Wed Apr 10, 2024 6:57 pm

Re: Cannot save article - term_id does not have a default value

Post by dfs-aviators » Sat Apr 13, 2024 9:16 pm

Thanks for your reply.

Is there a straightforward way to compare the DB structures without having to do a complete J4 install myself?

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 31087
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Cannot save article - term_id does not have a default value

Post by Per Yngve Berg » Sun Apr 14, 2024 6:31 am

Do you use the Smart Search (finder) to search on your Site?

The articles must be indexed before any search can be done.

dfs-aviators
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Wed Apr 10, 2024 6:57 pm

Re: Cannot save article - term_id does not have a default value

Post by dfs-aviators » Sun Apr 14, 2024 8:43 pm

Per Yngve Berg wrote: Sun Apr 14, 2024 6:31 am Do you use the Smart Search (finder) to search on your Site?

The articles must be indexed before any search can be done.
Hi, no I don't. I have also deactivated all components associated with Smart Search.
Maybe because of that as well, when I click on 'Search' under Components Tab, I am facing the error
'Call to a member function get() on null'


Post Reply

Return to “Administration Joomla! 4.x”