Expected behavior
Model preview works just like in dbt cloud studio
Actual behavior
When using the Power User for dbt preview feature on a model containing a nested CASE inside another CASE, dbti panics with:
runtime error: index out of range [-1]
The panic occurs in extractValues at dbt.go:101, called from normalizeParams → InvokeDBT → showCommandHandler. The raw panic output is then returned to the caller, which fails to parse it as JSON:
SyntaxError: Unexpected token 'p', "panic: run"... is not valid JSON
Steps To Reproduce
- Create a dbt model with a nested CASE expression, e.g.:
CASE
WHEN MONTH(some_date) < (
CASE
WHEN some_col = 'JAN' THEN 1
WHEN some_col = 'FEB' THEN 2
...
END
)
THEN ...
ELSE ...
END
- Compile and run the model successfully in dbt
- Attempt to preview the model using Power User for dbt
Log output/Screenshots
goroutine 1 [running]: dbt-labs/dbti/cmd/util.extractValues({0x16d2d6aa9?, 0x8?}) /home/runner/work/dbti/dbti/cmd/util/dbt.go:101 +0x214 dbt-labs/dbti/cmd/util.normalizeParams({0x140001ba360?, 0x102c8b204?, 0x102fcef5e?}) /home/runner/work/dbti/dbti/cmd/util/dbt.go:76 +0x90 dbt-labs/dbti/cmd/util.InvokeDBT({0x1031d16a0, 0x1400025a540}, {0x1031cc148, 0x1400011b1a0}, {0x140001ba360, 0x9, 0x9}, 0x0, 0x1, 0x0) /home/runner/work/dbti/dbti/cmd/util/dbt.go:24 +0x84 dbt-labs/dbti/cmd.Show.showCommandHandler.func1(0x140001f3208, {0x140001a2300?, 0x4?, 0x102fceeee?}) /home/runner/work/dbti/dbti/cmd/show.go:189 +0xd94 github.com/spf13/cobra.(*Command).execute(0x140001f3208, {0x140001a2240, 0xc, 0xc}) /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:944 +0x63c github.com/spf13/cobra.(*Command).ExecuteC(0x140001be308) /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x320 github.com/spf13/cobra.(*Command).Execute(0x1031d1768?) /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992 +0x1c main.main() /home/runner/work/dbti/dbti/main.go:21 +0xf0 : SyntaxError: Unexpected token 'p', "panic: run"... is not valid JSON
Operating System
macOS 26.3.1
dbt version
dbt Cloud CLI - 0.40.15
dbt Adapter
dbt-snowflake
dbt Power User version
0.60.4
Are you willing to submit PR?
Expected behavior
Model preview works just like in dbt cloud studio
Actual behavior
When using the Power User for dbt preview feature on a model containing a nested
CASEinside anotherCASE, dbti panics with:runtime error: index out of range [-1]The panic occurs in
extractValues at dbt.go:101,called fromnormalizeParams→InvokeDBT→showCommandHandler. The raw panic output is then returned to the caller, which fails to parse it as JSON:SyntaxError: Unexpected token 'p', "panic: run"... is not valid JSONSteps To Reproduce
Log output/Screenshots
goroutine 1 [running]: dbt-labs/dbti/cmd/util.extractValues({0x16d2d6aa9?, 0x8?}) /home/runner/work/dbti/dbti/cmd/util/dbt.go:101 +0x214 dbt-labs/dbti/cmd/util.normalizeParams({0x140001ba360?, 0x102c8b204?, 0x102fcef5e?}) /home/runner/work/dbti/dbti/cmd/util/dbt.go:76 +0x90 dbt-labs/dbti/cmd/util.InvokeDBT({0x1031d16a0, 0x1400025a540}, {0x1031cc148, 0x1400011b1a0}, {0x140001ba360, 0x9, 0x9}, 0x0, 0x1, 0x0) /home/runner/work/dbti/dbti/cmd/util/dbt.go:24 +0x84 dbt-labs/dbti/cmd.Show.showCommandHandler.func1(0x140001f3208, {0x140001a2300?, 0x4?, 0x102fceeee?}) /home/runner/work/dbti/dbti/cmd/show.go:189 +0xd94 github.com/spf13/cobra.(*Command).execute(0x140001f3208, {0x140001a2240, 0xc, 0xc}) /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:944 +0x63c github.com/spf13/cobra.(*Command).ExecuteC(0x140001be308) /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x320 github.com/spf13/cobra.(*Command).Execute(0x1031d1768?) /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992 +0x1c main.main() /home/runner/work/dbti/dbti/main.go:21 +0xf0 : SyntaxError: Unexpected token 'p', "panic: run"... is not valid JSON
Operating System
macOS 26.3.1
dbt version
dbt Cloud CLI - 0.40.15
dbt Adapter
dbt-snowflake
dbt Power User version
0.60.4
Are you willing to submit PR?