XBRL: a malformed schemaRef or linkbaseRef URL aborts loading with a raw ValueError
Bug
With XBRLBackendOptions(enable_remote_fetch=True), a malformed URL in an XBRL schemaRef, linkbaseRef, roleRef, or arcroleRef can abort loading. For example, http://[broken/x.xsd reaches urllib.parse.urlsplit() through Arelle's web cache and raises ValueError: Invalid IPv6 URL. When source_uri is set, the same malformed reference can raise earlier while Docling rewrites relative references.
The malformed reference should instead be rejected through the existing fetch-policy refusal path. Loading can then report a DocumentLoadError caused by OperationNotAllowed, with a message that names the reference and reason, such as http://[broken/x.xsd (Malformed URL), consistently with other refused references.
Steps to reproduce
Load an XBRL instance containing this reference with remote fetching enabled:
<link:schemaRef xlink:type="simple" xlink:href="http://[broken/x.xsd"/>
Use either of these backend configurations:
XBRLBackendOptions(enable_remote_fetch=True)
XBRLBackendOptions(
enable_remote_fetch=True,
source_uri="https://example.com/r/a.htm",
)
The earlier Docling rewrite failure with source_uri can also be reproduced directly from the repository workspace:
python -c "from pathlib import Path; from docling.backend.xml.xbrl_backend import _absolutize_missing_refs as f; print(f(b'<link:schemaRef xlink:href=\"http://[broken/x.xsd\"/>', Path('/tmp'), 'https://example.com/r/a.htm'))"
Current behavior: loading aborts because urllib raises ValueError: Invalid IPv6 URL (directly in the rewrite case, or from inside Arelle's web-cache path).
Expected behavior: the malformed URL is refused through the fetch-policy path, and the resulting error identifies both the URL and Malformed URL reason. Valid reference URLs behave unchanged.
Docling version
2.151.1
Python version
Python 3.12 on macOS arm64
Classification labels added: bug, priority:low, xbrl.
These labels are advisory. Maintainers can correct them. The workflow preserves these corrections.