libOpenCOR: Passing On libCellML's Parser Messages

Platform: libOpenCOR · Type: Issue / error messages · Status: Open, waiting for a reply (opened November 2, 2026) · Issue: #635

Context

libOpenCOR is the OpenCOR project's library for organizing, editing, simulating and analyzing CellML files. It reads CellML through libCellML, and it's one of the tools my conformance corpus checks.

What I Found

When libCellML's Parser reports an error, libOpenCOR 1.20261029.0, its newest release, reads the file as an unknown file. The only message is then a general one, and the Parser's own message, which says what is wrong and where, never reaches the person reading the model.

For example, with a component import that has no xlink:href attribute:

import libopencor

file = libopencor.File("2.2.1.import_href_attribute_missing.cellml")
print(file.type, [issue.description for issue in file.issues])
# Type.UnknownFile ['The file is not a CellML file, a SED-ML file, or a COMBINE archive.']

For the same file, libCellML's Parser says Import does not specify an xlink:href attribute.

The same happens with a unit multiplier of +2, a reset order of 20 digits and a file that declares XML 1.1. There, libCellML's messages are themselves findings, in #1505 and #1517. Passing them on would also show where an outcome comes from.

Two Crashes That Belong to libCellML

The corpus also showed libOpenCOR ending with a segmentation fault on two invalid files: a cycle among units, and an empty cn inside degree. Before reporting them here, I ran libCellML on its own with the same files. It ended the same way, so both crashes come from libCellML, and I reported them there, as findings 7 and 17 of #1517.

The libOpenCOR issue mentions the units cycle in one short paragraph, for the record, and points to #1517.

My Contribution

Issue #635 explains what happens, with the short example above, and asks whether libOpenCOR could pass on the Parser's messages in this case, perhaps after the current one. It links the corpus report, which shows every libOpenCOR outcome.

Process

What's Next

I'll wait for the maintainer's reply. If the Parser's messages are passed on, the corpus report will show them for libOpenCOR too, so each outcome will say what is wrong, not only that something is.

Reflection

"The file is not a CellML file" is honest, but quiet: it says that something went wrong, not what. The exact message was already there, one step below. A general message where a precise one exists is one of the gentlest kinds of silent failure, and one of the easiest to fix.

Running the lower library on its own also kept the reports fair. A crash first seen in libOpenCOR turned out to belong to libCellML, so it went to the place where it can be fixed once for every tool that builds on it.