ODK Build produces invalid form

What is the problem? Please be detailed.
I've created a quite extensive survey form using ODK Build. However, when trying to upload it to Aggregate it is flagged as invalid. I've now used XLSForm Online to get some more detailed information on the error.

This is the error message:

Error: b'ODK Validate Errors:\n>> XForm is invalid. See above for the errors.\norg.javarosa.xform.parse.XFormParseException: Encountered a problem with display condition for node [${basic}] at line: (), Bad node: org.javarosa.xpath.parser.ast.ASTNodeAbstractExpr@5f5a92bb\n\nResult: Invalid'

[${basic}] is the first Group within my survey. When I delete the group entirely, the same message appears, then naming the second Group in the form.

Anybody having any idea what the "problem with display condition" could be?

When I use ODK Validate I get a different error message

org.javarosa.xform.parse.XFormParseException: Encountered a problem with display condition for node [/data/biodata/marriage/spouse] at line: (selected(/data/biodata/marital_status, '1')) and ((selected(${type_marriage}, 'monogamy') OR selected(${type_marriage}, 'polygamy'))), Couldn't understand the expression starting at this point: ...and ((selected(?${type_marriage...

Is there some error with my formulas?

If you don't attach the build form, we won't be able to help...

I was thinking about attaching it but the form contains a lot of sensitive information, so I decided to wait if maybe someone has an idea without seeing it.

Anyway, I found the lead to the problem in another thread. When exporting the form to Excel, the relevant column contained a lot of (), mainly select-one elements and groups.

Conditions I put myself in ODK Build were distorted even more. This expression for example

(selected(/data/type_marriage, 'monogamy') or selected(/data/type_marriage, 'polygamy'))

Looked like this in the Excel

(() and (s) and (e) and (l) and (e) and (c) and (t) and (e) and (d) and (() and (/) and (d) and (a) and (t) and (a) and (/) and (t) and (y) and (p) and (e) and (_) and (m) and (a) and (r) and (r) and (i) and (a) and (g) and (e) and (,) and ( ) and (') and (m) and (o) and (n) and (o) and (g) and (a) and (m) and (y) and (') and ()) and ( ) and (o) and (r) and ( ) and (s) and (e) and (l) and (e) and (c) and (t) and (e) and (d) and (() and (/) and (d) and (a) and (t) and (a) and (/) and (t) and (y) and (p) and (e) and (_) and (m) and (a) and (r) and (r) and (i) and (a) and (g) and (e) and (,) and ( ) and (') and (p) and (o) and (l) and (y) and (g) and (a) and (m) and (y) and (') and ()) and ())

Once I removed all the () and fixed the relevant conditions, the document became valid.

What version of ODK Build are you using?!

FYI I cut-n-pasted your above relevant expression into a simple form in ODK Build :

...and it comes out in the exported XLSForm appropriately as:

So I dont think ODK Build is the culprit here...