dbt-labs / dbt-labs/dbt

[Bug] Unexpected error message when `git` is not installed

Open
#9,537 1 comment 0 reactions 0 assignees View on GitHub
engine:v1 priority:p1 type:bug
Dominant language
Rust
Stars
13.8k
Forks
2.6k
Avg merge
21h 31m
Merged PRs (30d)
56

Description

### Is this a new bug in dbt-core?

- [X] I believe this is a new bug in dbt-core
- [X] I have searched the existing issues, and I could not find an existing issue for this bug

### Current Behavior

After upgrading macOS, I got the following output for `dbt debug`:

```
15:36:59 Running with dbt=1.7.5
15:36:59 dbt version: 1.7.5
...
15:37:00 Configuration:
15:37:00 profiles.yml file [OK found and valid]
15:37:00 dbt_project.yml file [OK found and valid]
15:37:00 Required dependencies:
15:37:00 Encountered an error:
Got a non-zero returncode running: ['/usr/bin/git', '--help']
```

Running `git --help` helped point to the underlying issue -- need to reinstall git via xcode!

```
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
```

Solution:

```shell
xcode-select --install
```

### Expected Behavior

Based on the code [here](https://github.com/dbt-labs/dbt-core/blob/169972f4805d1da946655154dcf6bd7bf30fd4b1/core/dbt/task/debug.py#L397-L403), I would have expected a different error message that looked like this:

```
15:37:00 Encountered an error:
Got a non-zero returncode running: ['/usr/bin/git', '--help']
Error from git --help: xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
```

But an even _better_ message would look like this:

```
15:37:00 Encountered an error:
Got a non-zero returncode running: ['/usr/bin/git', '--help']
Error from git --help: PRINT THE EXCEPTION MESSAGE HERE

Make sure that `git` is installed in your shell and that `git --help` can execute successfully.
```

### Steps To Reproduce

1. Run `dbt debug` and see that it works
1. Uninstall git in your shell
1. Run `dbt debug` and see the less-than-helpful error message:
```
Got a non-zero returncode running: ['/usr/bin/git', '--help']
```

### Relevant log output

```shell
See above.
```

### Environment

```markdown
- OS: macOS
- Python:
- dbt: 1.7
```

### Which database adapter are you using with dbt?

_No response_

### Additional Context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.