Locating the error

Is there a way to narrow down the location of what’s causing the below error?

I’m brand new to MODX, and I’ve mostly worked out issues, but this one has me stumped.

There’s literally thousands of this error every day.

core/xpdo/om/xpdoobject.class.php : 811) modTemplateVar: Attempt to set NOT NULL field type to NULL

Thank you!

1 Like

Hi @s4mh4ll,

Welcome to the modx community!

Well, this seems to be a problem with a template variable using a NULL assignment when the DB field was set as NOT NULL.

you can try to do to the modx seetings and enable the debug and enable the log level to 4, and try to see if you get more detailed messages.

This will help you to know what is effectively not OK.

Cheers

1 Like

Hi @jnogueira,

Thank you for the welcome!

That has certainly helped, thank you.

Errors are now like this;

modx/modlexicon.class.php : 416) Language string not found: "prop_formit.fiartpl_desc"

If you are able to give me any pointers in the right direction, it would be much appreciated.

1 Like

Hum… That error is unrelated to the one on your first post.

Do you have migx installed on your current Modx instance?
If you have migx installed, do you have any Migx TVs?

I am asking this because it can happen this in Migx where you didn’t set a inputTV on the template Var (migx type).
See more about this here

1 Like

Ah yes, looking back into the log I’m still getting the original error, too. Which hasn’t changed and isn’t giving any more details.

Yes, I do have MIGX installed.

Am I right in thinking that I’m looking for Template Variables with labels ending ‘-migx’?

1 Like

Not necessarily. If the dev that created the TemplateVars added that suffix for easier identification, then it was a good way to find them quickly, but it is not a direct flag as you can change the TV settings and not change the name.

I suggest the following:

  1. Check all your TemplateVars to confirm that all are set properly - The problem should not be here.
  2. Check your Migx configs and confirm that all your formtab fields are having the attribute InputTV (even if set as empty). Example of a field:
{
          "MIGX_id":11940,
          "field":"name",
          "caption":"Name",
          "description":"Name",
          "description_is_code":"0",
          "inputTV":"",
          "inputTVtype":"text",
          "validation":"required",
          "configs":{
            "allowBlank":"false",
            "maxLength":255,
            "minLength":3,
            "regex":"",
            "regexText":""
          },
          "restrictive_condition":"",
          "display":"",
          "sourceFrom":"config",
          "sources":"",
          "inputOptionValues":"",
          "default":"",
          "useDefaultIfEmpty":"0",
          "pos":1
        }

Also ensure that the Migx database schema is proper:

  1. Database fields set properly, confirming NOT NULL attribute, data type and length, etc
  2. Your Migx config file needs to also have a defined default (even if empty. Check above).

I believe this will tackle your issue :slight_smile:

Cheers

1 Like

Thank you for your help so far.

I’m still lost, so I’m going to start from the beginning and learn from scratch, rather than attempt to fix someone else’s build without any knowledge of how MODX actually functions.

See you on the other side!

2 Likes

If during your research you need help, please let us know :wink:

Cheers and good luck

1 Like

The tvs names can be anything, maybe the original dev used some structure but it is not necessary at all. Because MIGX will often use multiple tvs it would seem to be rare that putting migx in the name would be helpful, more commonly the name represents the data contained in the tv.

You should be able to track the tvs that are in play through the template you are using, they will be called directly in the MIGX call. There can be other ways of pulling stuff in though, Modx is really flexible so there’s always another way to do something.

It is hard to reverse engineer someone else’s system due to this, but with MIGX is shouldn’t be too tough I would think. Still, starting from scratch can help a lot

Keep in touch if you have questions