Execute CQL outside an IG project fails with a `NoOpRepository.search` null error when the library uses a value set
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
The failure comes from the terminology repository built in CqlEvaluator.kt from libraryResolutionManager.getInputDirectories(), which becomes NoOpRepository when no IG project is present; NoOpRepository.kt's search method declares its map parameter non-null. Start by reading how CqlEvaluator uses the request's terminologyUri and check whether it can be passed into the repository construction. Done when the reproduction library evaluates the value set define without the non-null error, or the request fails with a clear message.
Written by the indexing model from the issue text.
Description
With cql-language-server 5.0.0, evaluating a library that retrieves by value set fails when the workspace holds no IG project, even when the request gives a terminologyUri.
To reproduce
A plain folder, with no ig.ini in it or above it, as the workspace:
Repro.cql
data/Patient/p1.json
data/Observation/o1.json (code a in http://example.org/fhir/CodeSystem/example)
valueset/ValueSet-example-codes.json
Repro.cql has
valueset "Example Codes": 'http://example.org/fhir/ValueSet/example-codes'
define "Has Coded Observation":
exists ([Observation: "Example Codes"])
The files of the reproduction
Repro.cql
library Repro
using FHIR version '4.0.1'
include FHIRHelpers version '4.0.1'
valueset "Example Codes": 'http://example.org/fhir/ValueSet/example-codes'
parameter Offset Integer default 1
context Patient
define "Has Coded Observation":
exists ([Observation: "Example Codes"])
define "Offset Plus One":
Offset + 1
data/Patient/p1.json
{ "resourceType": "Patient", "id": "p1", "birthDate": "2020-01-01" }
data/Observation/o1.json
{ "resourceType": "Observation", "id": "o1", "status": "final",
"code": { "coding": [{ "system": "http://example.org/fhir/CodeSystem/example", "code": "a" }] },
"subject": { "reference": "Patient/p1" } }
valueset/ValueSet-example-codes.json
{ "resourceType": "ValueSet", "id": "example-codes", "url": "http://example.org/fhir/ValueSet/example-codes", "status": "active",
"compose": { "include": [{ "system": "http://example.org/fhir/CodeSystem/example", "concept": [{ "code": "a" }] }] },
"expansion": { "timestamp": "2026-01-01T00:00:00Z", "contains": [{ "system": "http://example.org/fhir/CodeSystem/example", "code": "a" }] } }
I sent the request through cqframework/cql-mcp 0.1.0-rc.2 (cql_execute with cqlFile, contextValues: ["p1"], modelUri = the data folder, terminologyUri = the valueset folder).
What I see
Parameter specified as non-null is null: method org.opencds.cqf.cql.ls.server.command.NoOpRepository.search, parameter map
The same happens without terminologyUri. With the same files in an IG layout (ig.ini, input/cql, input/vocabulary/valueset) the define evaluates to true.
Likely cause (read, CqlEvaluator.kt and NoOpRepository.kt at v5.0.0; master at 1bed013 is the same)
The terminology repository is built from libraryResolutionManager.getInputDirectories(), and is a NoOpRepository when there are none. The request's terminologyUri is used in the grouping key but not to build that repository. NoOpRepository.search declares its map argument non-null and is called with null.
What would help
Either use terminologyUri when it is given, or return a message that says no terminology is available outside an IG project.
Two more runs, with an IG project in the workspace beside the plain folder:
- The IG has the value set and the request gives no
terminologyUri: the plain-folder library evaluates totrue, so it used the IG'sinput/vocabulary. That may be intended. - The IG has no value sets and the request gives
terminologyUri= the plain folder'svalueset:Unable to locate ValueSet http://example.org/fhir/ValueSet/example-codes. SoterminologyUriis not used there either, though the message is clear in that case.
Environment: language server jar from Maven Central, Temurin JDK 21, macOS arm64.
- Dominant language
- Kotlin
- Stars
- 2
- Forks
- 4
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 3
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from cqframework/cql-language-server
-
bug
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
multiple IG project fhir/package cache stubsMay be free again @raleigh-g-thompson claimed this 145 days ago, and no pull request is open. Openenhancement
cqframework/cql-language-server#155 · 1 assignee ·
-
debugger isn't working with muti-project setupsMay be free again @raleigh-g-thompson claimed this 146 days ago, and no pull request is open. Openbug
cqframework/cql-language-server#154 · 1 assignee ·
-
Need smaller jar buildMay be free again @raleigh-g-thompson claimed this 157 days ago, and no pull request is open. Openenhancement
cqframework/cql-language-server#146 · 1 assignee ·
-
Update master branch protection required checks after CI workflow rewriteMay be free again @brynrhodes claimed this 169 days ago, and no pull request is open. Openenhancement
cqframework/cql-language-server#142 · 1 assignee ·
All issues in cqframework/cql-language-server
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
The engine's "loaded, but had errors" message leaves out which library and line each error is inOpen
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
cqframework/clinical_quality_language#1980 ·
Maintainers usually reply within 3 days
-
Fun requireFragmentManager has been renamed to getParentFragmentManagerPossibly taken @xuenhua claimed this today. Openunconfirmed
Difficulty 1/5 Under an hour Newbie friendliness 82/100
thunderbird/thunderbird-android#11984 · 1 comment ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Droid-Deck/DroidDeck#3496 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
AChep/keyguard-app#1709 · 1 comment ·
Maintainers usually reply within 11 days