cubejs-cli validate never exits when the data model contains a Python file
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- node.js, python, typescript
- Domain
- cli
Research direction
Start in packages/cubejs-cli/src/command/validate.ts and compare its success path with displayError; cli.ts shows how the command is parsed. Reproduce with a Python model file using the provided cubejs-cli validate command, then verify that successful validation exits with code 0 while validation errors still exit non-zero.
Written by the indexing model from the issue text.
Description
Describe the bug
cubejs-cli validate never exits after printing ✅ Cube Schema is valid when the data model contains a Python file. The verdict is printed within seconds, then the process stays alive until killed (in our Cloud Build it ran into the build timeout with a valid schema).
Cause, as far as I can tell: packages/cubejs-cli/src/command/validate.ts returns after console.log('✅ Cube Schema is valid') without process.exit, and cli.ts ends with program.parse(process.argv). With a YAML-only model the event loop drains and Node exits. Once loadPythonContext has started the embedded Python runtime, something keeps the loop alive, so the process never ends. The failure path is unaffected because displayError ends with process.exit(1).
To Reproduce
On Linux x64 with libpython so the Python-enabled native build is selected (ldconfig -v must list libpython3.11):
docker run --rm -it node:22-bookworm bash
apt-get update && apt-get install -y libpython3.11
mkdir -p /repro/model && cd /repro
cat > model/globals.py <<'PY'
from cube import TemplateContext
template = TemplateContext()
PY
cat > model/orders.yml <<'YML'
cubes:
- name: orders
sql: select 1 as id
measures:
- name: count
type: count
YML
npx --yes cubejs-cli@1.7.34 validate --schema-path model
Output: ✅ Cube Schema is valid, then the process hangs. Delete model/globals.py and rerun: same output, process exits immediately.
Expected behavior
Process exits with code 0 after the success message (and non-zero on validation errors), so the command can be used as a CI gate.
Screenshots
n/a
Minimally reproducible Cube Schema
See the two files above; any Python file in the model directory triggers it, the cube itself is irrelevant.
Version:
cubejs-cli 1.7.34, @cubejs-backend/native 1.7.34 (native-linux-x64-glibc-3.11), Node 22.23.2, Debian bookworm. validate.ts on master has the same shape, so presumably also 1.7.40.
Additional context
- Not reproducible on macOS: the native package only ships the fallback build there, so
validatefails withPython (loadPythonContext) is not supported because you are using the fallback build of native extensionand exits 1 before the runtime starts. - Suggested fix:
process.exit(0)after the success log invalidate.ts(or exit withprocess.exitCodeset from the result), mirroring howdisplayErroralready exits on failure. - Workaround we use in CI:
grep -m1 "Cube Schema is valid" < <(npx --yes cubejs-cli@1.7.34 validate --schema-path model 2>&1 | tee /dev/stderr).
- Dominant language
- Rust
- Stars
- 20.9k
- Forks
- 2.1k
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 201
Contributor guide
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 cube-js/cube
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100