Application Building Errors

This page will help you to interpret some of the common error messages you find while trying to make builds of your application.

Invalid XML in Form

You have written something invalid into one of your forms. 

1) Navigate to the erroneous form.  You should see red error bars at the top.  Take a look at the first error bar on the page for information that could help you identify the error.

2) Open your form in Vellum (the form designer) and fix any errors Vellum identifies.  If your form will not display in Vellum, go to the “advanced” dropdown and click “Edit Source XML”. 

3) If you still have not identified the error, go to “Edit Source XML” and copy all the content.  Paste it into the form validator: https://www.commcarehq.org/formtranslate/# .  Click “verify” to help identify xml errors.

Blank Form

One of your forms is blank.  If you add a form to your app in the CommCare HQ app builder, you must place  some questions in the form. 

To fix the problem, click on the form or forms that CommCareHQ identifies as blank.  Then either delete the form or create questions in the form.  To delete the form, click the “delete form” link on the top right.  To create form content,  click “create” – this will bring up Vellum, the form designer.  Add questions to create your form, or just click “save” to save a simple working form.

Your app requires numeric passwords but the admin password is not numeric

You need to reset your admin password.

  1. Go to settings. (Below the Deploy button)

  2. Find "Java Phone General Settings"

  3. Find the Admin Password button, and select Reset.

  4. Enter a new password ( Only use numbers 1 , 2, 3 ...) and hit Save.

If you would like to have an alphanumeric password (numbers and letters, ie. ict4d) choose the "Password Format" setting on the same screen.

No case detail: uses cases but doesn't have detail screens configured for cases.

You are using cases, but have not configured the case list/detail screens.  Your application will contain a list of cases that the mobile user has registered.   When the user fills out a form that requires a case (a followup form), the user must select a case from the case list before filling out the form.  The user is presented with two views to help select the case:  the Case List view and the Case Detail view.

To configure these views, click on the module or modules that CommCareHQ links you to.  Scroll down until you see the section “Case Details”.  You’ll see that it lists all the case properties in this module – those that you’ve saved, as well as some automatic default case properties. 

Click on at least one property to add it to the Case List, and hit save.

No forms:  module has no forms.

You must have at least one form in each module.  Click on the name of each module and make sure you have created at least one form in each module.  Note that it is not enough to click “+” to add a form – you must also click “create” for each form and give the form some content.  Alternatively, you can delete any empty modules.

No case type: module uses cases but doesn't have a  case type defined.

 You have configured case management in at least one of your modules.  In case management, a module contains a case list – a list of whatever you are tracking.  Each module is about one “type” of case that you are tracking.  For example, you might have a “mother” module that tracks mothers, and a “child” module that tracks children.  All the forms in the “mother” module will apply to mothers ,and all the forms in the “child” module will apply to children.

You need to specify this case type by clicking on the module and writing one descriptive word in the field “case type”.

Form error:  one or more forms are invalid: check all your forms for error messages.

CommCareHQ tries to identify errors in your forms before you put the app on the phone.  One or more of your forms contain errors.  If you click on a form, you should see any errors we've found come up in a red box at the top.  Right now we expose as much information as possible - but for most users, only the first red box at the very top of the page will be helpful.

Missing languages

CommCare apps are multilingual – meaning you can specify each question’s text in several different languages.  CommCare needs to know which languages you’re using, so it can try to find the right default translations for the menu buttons and error messages.  If you saw this error, it’s because your application does not have any languages specified.

By default your application will be set to the English language.

To change this language or add more languages, click on the name of your application and scroll down to the “Languages” section and start typing the name of your language.  It will autocomplete to the language code that CommCare understands.  If CommCare does not have your language code, it’s OK to make up a new 3-letter code.

Case Update uses reserved word     

There are certain words you cannot use as a case property name.  If you see this error, it means you have used one of these “reserved” words.  Here’s a list of all the “reserved” words you cannot user as case property names:

  • "actions"

  • "case_name"

  • "case_type"

  • "case_type_id"

  • "closed"

  • "closed_on"

  • "date_opened"

  • "external-id"

  • "date"

  • "doc_type"

  • "domain"

  • "indices"

  • "index"

  • "modified_on"

  • "opened_on"

  • "referrals"

  • "server_modified_on"

  • "status"

  • "type"

  • "user_id"

  • "userid"

  • "version"

  • "xform_id"

  • "xform_ids"


Case Update.  [some word] should start with a letter and only contain letters, numbers, '-', and '_'

You have used illegal characters in one or more of your case property names.  Your case property names must start with a letter and can only contain letters, numbers, -, and _.  Note that your case property names cannot contain spaces or punctuation, and cannot start with a number.

The case configuration in form [some form]  contains the invalid path [some path]

If you see this error, it means that you’re trying to save from or load into a question in your form that no longer exists or has been moved.   This can happen if you move, delete, or rename question that you were using in your case configuration.  Click on the form and you should see [?] next to the case properties that refer to invalid questions.  To fix the issue, re-select the correct question from the dropdown and hit “save”.

Empty language: one of your languages is empty.

In order for your application to work properly, you must have specified some text for every question in the app’s default language.  If you see this error, it means the display text of at least one question is missing in your default language.  Go through your forms and make sure you have written something for each question.

The Form Designer sets some default text for each question in each language, to help ensure that you don’t get this error!

Dependency cycles amongst the xpath expressions in relevant/calculate

In your form, the display or calculate logic in a question references itself.  This is normally caused by using a "." in the display logic or calculate logic for a question.  Please check the logic in the questions listed at the bottom of the error. 

Validation Error: For input string: "GPS"

The property /data/GPS is set to take default value 'GPS', but this is not a valid value for this question type. Remove the default value.

Case sharing for web users

When case sharing is turned on, it will often break when you attempt to preview a form because a web user cannot be in a case sharing group. The error message will look like:

"Logic references instance(groups)/groups/group/@id which is not a valid question or value"  

Common Repeat Group Error: Multiple Nodes Error

Overview

Often while using Repeat Groups (especially when multiple repeat groups are nested ), users face an issue which states something like this "Cannot convert multiple nodes to a raw value. Refine path expression to match only one node.". This document aims at trying to find the reason for such errors and how to resolve such issues in a repeat group.

Reason for Multiple nodes error

Before understanding the reason for the Multiple Nodes error in Repeat Group, you need to understand what a node means for a repeat group.

What is a Node?

In CommCare, almost everything is an XML structure behind the user interface. Any question you add on a form, any new form, and even an application has an xml structure behind it. An XML structure in any form can consist of a smaller XML structure which is called a node. In simplicity, a form consisting of questions basically means the form's xml node consists of different question nodes. Similarly, the cases in case-db of users are also stored in nodes of cases.

Node in case of Case-DB

The case-db node consists of nodes of cases. So when you use the statement instance('casedb')/casedb/case , you are telling CommCare to refer to all nodes of case-db. When you use instance('casedb')/casedb/case[@case_type = 'mother'][@status = 'open'], you are telling CommCare to refer to all the nodes of case-db whose case type is 'mother' and are still 'open' . Assuming that user has multiple cases of type 'mother' which are open, the output of this statement, instance('casedb')/casedb/case[@case_type = 'mother'][@status = 'open'], is always a set of nodes of cases (or this will result in Multiple Nodes)

Also, when you use instance('casedb')/casedb/case[@case_type = 'mother'][@status = 'open']/case_name, this will result in multiple nodes with just case_name

image-20240423-213248.png

When you face the issue "Cannot convert multiple nodes to a raw value. Refine path expression to match only one node." in a repeat group, it means that in one of your question's calculations (or any configuration of the question) is expecting a single node but as per the logical statement you are using results in multiple nodes and CommCare is unable to resolve as to which node it should use do process your logical statement. For example, consider an application which registers a mother (case type : mother) and her children (case type : children) . Assuming that you have registered more than 2 mother cases and each mother case has 3 children cases created with a relation of parent-child between these two case types. There is a form which will now show the user the name of mother along with the list of children under each mother. For this, form uses a repeat group to iterate through the 'mother' case type nodes.

worddav6962bb8ef803e52b147907e5c9bb8814.png

Now let's say you wanted to show the details first, before showing the details of the children of her children. For that you added a hidden variable type question to fetch the name of the mother whose case-id is currently in the loop. In that hidden variable's calculation, you added this calculation instance('casedb')/casedb/case[@case_type = 'mother'][@status = 'open']/case_name

Now , when you try to open the form, you will get the error "Cannot convert multiple nodes to a raw value. Refine path expression to match only one node" and the reason is clear that the calculation used for the hidden variable is resolving to a set of nodes of cases and not a single case as shown:

Resolution for Multiple nodes error

In this section, you will try to work on resolving the multiple nodes error which you saw in the last section.

Identification of erroneous calculation

First you need to identify the variable of the form which is throwing you the error.
If you see the error : "Calculation Error: Error in calculation for /data/mother_details/mother_iteration/item/mother_details_section/mother_name XPath nodeset has more than one node …… cannot convert multiple nodes to a raw value. Refine path expression to match only one node."

 

The highlighted text will guide you the exact location of variable where the error originates:

Fixing the error

Once the erroneous calculation is located, you need to fix the calculation involved. In the example you have seen, the calculation used for populating the name of mother is resolving into multiple nodes. Hence the error is thrown by the form. For fixing this particular error, you need to make sure that calculation results in a unique single node.
The expression used instance('casedb')/casedb/case[@case_type = 'mother'][@status = 'open']/case_name clearly doesn't have any conditioning to make sure it results in a unique node. In order to make this instance expression to yield a unique node, you will have to add a filtering condition on case-id . Since the current hidden variable is under a repeat group, the current index of the repeat group will be needed to fetch the current caseid . instance('casedb')/casedb/case[@case_type = 'mother'][@status = 'open'][@case_id =variable storing mother's case id]/case_nameFor the example used, this expression would be : instance('casedb')/casedb/case[@case_type = 'mother'][@status = 'open'][@case_id = #form/mother_details/mother_iteration/item/mother_id]/case_name
Adding the highlighted filter on expression, you can make sure that the calculation only yields a unique node and the error of multiple nodes is not anymore.

Other Reasons

There could be multiple other reasons for Commcare throwing the multiple node error but the core of the reason remains the same i.e. somewhere some question calculation or a question which uses a calculation (which is further used in another question type like a label) is referring to a multiple node as a result of its calculation. In a couple of cases, this error also results from referring to a variable without using a correct reference to a question within a repeat group. If you use easy references with double-nested repeat groups the app can get confused pretty fast.

Troubleshooting

The first step in troubleshooting things like this is

  • Identify the question/calculation which is throwing the error.

  • Check for calculation conditions/display conditions/lookup-filters/default value of that question

  • If these calculations are based on an easy reference to another question, then it could be a possible issue. Usually removing any easy references and replacing them with relative paths to the question will fix the issue for you. Using easy reference is safe when a form is straight-forward and doesn't have complexities of nested repeat groups. But if the form has nested repeat groups, the safest bet is to use relative referencing in a repeat group.

  • Note: Most common source for this type of error is due to usage of easy reference in a lookup-table type question's filters OR a Calculation Condition involving reference to fixture data like locations or lookup-tables with filtering condition using easy referencing. 

Using current() expression with the correct referencing path is the safe way to avoid any multiple node error in repeat groups. The details of using current() expression is covered at https://dimagi.atlassian.net/wiki/x/pC7Kfw.