Skip to content

Fix misleading warning when evaluating Jinja in dbt_project.yml fails #388

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changes/unreleased/Fixes-20250713-042047.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: Fixes
body: Fix misleading warning when evaluating Jinja in dbt_project.yml fails
time: 2025-07-13T04:20:47.898266+02:00
22 changes: 10 additions & 12 deletions crates/dbt-parser/src/dbt_project_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ use std::{
path::{Path, PathBuf},
};

use dbt_common::{
fs_err, io_args::IoArgs, show_error, show_warning_soon_to_be_error, ErrorCode, FsResult,
};
use dbt_common::{fs_err, io_args::IoArgs, show_error, ErrorCode, FsResult};
use dbt_schemas::schemas::project::{
DataTestConfig, DefaultTo, IterChildren, ModelConfig, SeedConfig, SnapshotConfig, SourceConfig,
UnitTestConfig,
};
use dbt_schemas::schemas::{common::DbtQuoting, project::DbtProject};
use dbt_serde_yaml::ShouldBe;
use dbt_serde_yaml::{ShouldBe, WhyNot};

/// Used to deserialize the top-level `dbt_project.yml` configuration
/// for `models`, `data_tests`, `seeds` etc..
Expand Down Expand Up @@ -115,17 +113,17 @@ pub fn recur_build_dbt_project_config<T: DefaultTo<T>, S: Into<T> + IterChildren
};
let child_config_variant = match maybe_child_config_variant {
ShouldBe::AndIs(config) => config,
ShouldBe::ButIsnt { raw, .. } => {
ShouldBe::ButIsnt { raw, why_not } => {
let error_msg = match why_not {
WhyNot::Custom(message) => message,
WhyNot::Original(error) => &error.display_no_mark().to_string(),
};
let err = fs_err!(
code => ErrorCode::UnusedConfigKey,
code => ErrorCode::SerializationError,
loc => raw.as_ref().map(|r| r.span()).unwrap_or_default(),
"Ignored unexpected key `{:?}`. YAML path: `{}`.", key.trim(), key_path
"Failed to parse `{key_path}`: {error_msg}"
);
if std::env::var("_DBT_FUSION_STRICT_MODE").is_ok() {
show_error!(io, err);
} else {
show_warning_soon_to_be_error!(io, err);
}
show_error!(io, err);
continue;
}
};
Expand Down