ruODK error for form_schema_ext(): "Expecting an external pointer: [type=NULL]"

Hi all,

I have a question about a recent error we've been getting using ruODK. Specifically, the function form_schema_ext() throws the error: "Error in xml_nodeset(NextMethod()): Expecting an external pointer: [type=NULL]"

I tried to trace the error in the function (here: https://rdrr.io/github/dbca-wa/ruODK/src/R/form_schema_ext.R) and I think the problem occurs at line 476:

if (has_translation_choice) {
id_choice <- xml2::xml_text(
xml2::xml_find_first(this_choiceitem, paste0("./", choicelabel_node))
)

where choice id get's assigned an NA value. Unfortunately, I can't share an example here of the data coming out of the API. The error only occurs for datasets with multiple languages. Perhaps the structure of the data changed for such datasets in a recent update? Really only guessing here.

I understand that the description of my problem might be a bit unspecific. Please let me know if there is anything I can do to make the issue clearer. Any advise on how to solve the issues would be appreciated!

Coen

Thanks for the report @CoenLouis, I'll take a look at that method and see whether I can reproduce the error.

Any chance you could share the form that throws this error here? A minimal version with just the offending question would be massively helpful.

Quick ping to the author of that function @Mtyszler for reference.

Hi Florian,

Thanks for your quick reply. I'll send you a dm with the relevant extract of the form. Hope that's alright.

Kind regards,
Coen

@Florian_May,

Whilst preparing the form for you I noticed that the question that was throwing the error didn't have the value labels filled in for either language for the relevant form list. I uploaded the form again but now with all labels and it works :). Sorry for bothering you with something I could've figured out myself but thanks for pointing me in the right direction! Much appreciated.

Let me know if you want some more info or if we can close the topic.

Hey good work, thanks for chasing that up. Ideally ruODK could warn against missing labels. ODK Build could also warn here.

I think since this is no critical bug, I'll file GH issues for the above warnings and would say this report here could be marked as solved.

2 Likes

Tks @CoenLouis for the report and own solution and @Florian_May for following it up.

It seems that indeed it boils down to an edge case where labels are missing from the form definition and as a consequence have no xml node to be found.

We could see this in two ways:

  • it is a case where you actually don't want publish a form like this (since this would lead to a question with empty labels for the choices), so ruODK shouldn't worry about it and the error is an acceptable "consequence" of a likely mistake in the form
  • it is a edge case, but ruODK should force an empty value and/or send the user a warning, but not break during execution.

I'll leave the choice to @Florian_May

1 Like

Tracking this issue at ruODK and ODK Build. Contributions welcome!

1 Like

Sorry for the late response, I had a few days off. The survey is being deployed now and everything runs smoothly.

Thanks for picking this up @Mtyszler and @Florian_May.

2 Likes