how to fix great expectations data context not found error failed to load
Data context not found means Great Expectations started in a directory or mode without the configuration it expects: check the working directory for the great_expectations folder, set the context mode or the GX_HOME style path explicitly in code, or switch to an ephemeral context with the datasource defined in code. Use when a Great Expectations project that fails to load its data context. Not for a checkpoint.
TL;DR
Data context not found means Great Expectations started in a directory or mode without the configuration it expects: check the working directory for the greatexpectations folder, set the context mode or the GXHOME style path explicitly in code, or switch to an ephemeral context with the datasource defined in code. Pin the approach so local runs and CI stop diverging.
how to fix great expectations data context not found error failed to loadUse this when
- The check or run fails with this symptom: data context not found or failed to load is raised at startup.
- You are working on a Great Expectations project that fails to load its data context and the failure repeats on the same data or configuration.
- You need the failing rows, rule, or stage isolated before changing thresholds or code.
Not for this skill when
- A checkpoint failure after the context loads, which means the context was found and the data is at fault instead.
- The error text names a different tool, stage, or root cause. Match the verbatim error first and use that skill.
Steps
- Print the working directory and list whether a great_expectations configuration folder exists there and what it contains. Verify: the presence and location of the configuration are confirmed
- Check how the code obtains the context: file mode, ephemeral mode, or cloud mode, and which path or identifier it passes. Verify: the context mode and path in code are explicit
- Run the context load from the project root and from the job's working directory to reproduce the difference. Verify: the directory dependence is demonstrated or ruled out
- Fix by running from the project root, passing the context path explicitly, or defining an ephemeral context in code for CI. Verify: the context loads from every entry point used in practice
- Load a datasource from the context and list its assets to prove the context is fully usable, then run one checkpoint. Verify: assets list correctly and the checkpoint starts
Variant phrasings
great expectations data context not found
The verbatim not-found phrasing.
data context failed to load great_expectations folder
The folder-discovery phrasing for file contexts.
great expectations ephemeral context CI not found
The CI phrasing, where the runner starts outside the project root.
Compatibility: Great Expectations 0.18 and 1.x file-based and fluent data contexts
Why it happens
File contexts are discovered relative to the working directory, so schedulers, notebooks, and CI runners that start elsewhere find nothing. Mode mismatches, such as code expecting a file context where only an ephemeral one was defined, produce the same not-found error.
Edge cases / pitfalls
- Committing an empty configuration folder makes discovery succeed but validation meaningless. Check the datasources inside the loaded context.
- Keep one context strategy per project. Mixing file and ephemeral modes across scripts guarantees recurrence.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_D5j2dx5KlqAAqSOMQTbzSQ