dbt-labs / dbt-labs/metricflow

[Bug] Metric-scoped list commands do not mark --metrics as required

Open
#2,109 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.8k
Forks
202
Avg merge
1d 8h
Merged PRs (30d)
14

Description

### Is this a new bug in metricflow?

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

### Current Behavior

Running `mf list dimensions` or `mf list entities` without `--metrics` fails with an internal sequence-validation message, even though the CLI help presents the option as optional:

```text
Error: Invalid value for '--metrics': Input is empty, when the minimum expected number of input is 1
```

Both commands configure `SequenceParamType(min_length=1)` with `default=""`, but do not mark the option as required. Their command descriptions also say that they list all unique dimensions or entities, while the implementation returns the intersection for specified metrics.

This is a CLI contract and error-message issue; metric query behavior is not affected.

### Expected Behavior

Because both commands require at least one metric, `--metrics` should be displayed as required. Omitting it should produce Click’s standard missing-option error:

```text
Error: Missing option '--metrics'.
```

The command descriptions should state that the returned dimensions or entities are common to the specified metrics.

### Steps To Reproduce

1. Install `dbt-metricflow==0.13.0`.
2. Run `mf list entities`.
3. Observe the internal empty-sequence validation error.
4. Run `mf list dimensions`.
5. Observe the same error.
6. Run either command with `--help` and observe that `--metrics` is not marked required.

### Relevant log output

```shell
Usage: mf list entities [OPTIONS]
Try 'mf list entities --help' for help.

Error: Invalid value for '--metrics': Input is empty, when the minimum expected number of input is 1
```

### Environment

- OS: Linux
- Python: 3.12.13
- dbt: 1.11.12
- dbt-metricflow: 0.13.0
- metricflow: 0.211.0

### Additional Context

The commands were introduced to return objects common to the supplied metric inputs. A focused fix is to replace the empty defaults with `required=True`, preserve the existing option help, clarify the command-level descriptions, and add regression coverage for both commands.

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.