jdx/mise · error

cannot contain empty values

Error message

{key} cannot contain empty values

What it means

The same string_list helper validates that after parsing, none of the collected values is empty or whitespace-only. An empty entry would produce a meaningless pipx flag (e.g. `--with ''`), so mise rejects the option list.

Solutions

  1. Remove the empty/whitespace entries from the array
  2. Quote and fill in values where a placeholder was left blank: `with = ["pytest"]`
  3. If a value comes from a variable, guard against it expanding to empty

Example fix

# before
[tools]
foo = { source = "pipx", with = ["", "black"] }
# after
[tools]
foo = { source = "pipx", with = ["black"] }
Defensive patterns

Strategy: validation

Validate before calling

// Reject empty/whitespace entries before passing options
const clean = (xs: string[]) => xs.filter(x => x.trim().length > 0);

Type guard

const hasNoEmpty = (xs: string[]) => xs.every(x => x.trim() !== '');

Prevention

When it happens

Trigger: Options like `with = ["", "black"]` or `expose = [" "]` — a string in the array that is empty or only whitespace.

Common situations: Trailing commas or blank entries in hand-edited TOML arrays; templating/variable expansion that produced an empty string; programmatic config generation emitting empty items.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/487504910cd2994b. Report an issue: GitHub.

Appendix: source

Thrown at src/backend/pipx.rs:93

                    serde_json::from_str(value)
                        .map_err(|_| eyre!("{key} must be a string or array of strings"))?
                } else {
                    vec![value.clone()]
                }
            }
            toml::Value::Array(values) => values
                .iter()
                .map(|value| {
                    value
                        .as_str()
                        .map(str::to_owned)
                        .ok_or_else(|| eyre!("{key} must be a string or array of strings"))
                })
                .collect::<Result<Vec<_>>>()?,
            _ => bail!("{key} must be a string or array of strings"),
        };
        if values.iter().any(|value| value.trim().is_empty()) {
            bail!("{key} cannot contain empty values");
        }
        Ok(values)
    }

    fn with(&self) -> Result<Vec<String>> {
        self.string_list("with")
    }

    fn expose(&self) -> Result<Vec<String>> {
        self.string_list("expose")
    }

    fn exposed_package_names(&self) -> Result<Vec<String>> {
        self.expose()?
            .into_iter()
            .map(|requirement| {
                let Some(name) = Self::requirement_package_name(&requirement) else {
                    bail!("expose must contain named Python package requirements");

View on GitHub (pinned to 533346cc37)