jdx/mise · error

dependency_prereleases must be a string

Error message

dependency_prereleases must be a string

What it means

The pipx backend's dependency_prereleases option controls whether dependencies may resolve to pre-release versions. It must be the string "disallow", "allow", "if-necessary", or "explicit". A non-string TOML value first raises this type error; a string outside the allowed set raises the related enum error.

Solutions

  1. Use a quoted string value: `dependency_prereleases = "allow"`
  2. Pick one of the four valid values: "disallow", "allow", "if-necessary", "explicit"
  3. Remove the option if you only want default (disallow) behavior

Example fix

# before
[tools]
foo = { source = "pipx", dependency_prereleases = true }
# after
[tools]
foo = { source = "pipx", dependency_prereleases = "allow" }
Defensive patterns

Strategy: validation

Validate before calling

// Validate dependency_prereleases before writing config
const valid = ['disallow','allow','if-necessary','explicit'];
const ok = (v: unknown) => typeof v === 'string' && valid.includes(v);

Type guard

const isPrereleaseMode = (v: unknown): v is 'disallow'|'allow'|'if-necessary'|'explicit' =>
  typeof v === 'string' && ['disallow','allow','if-necessary','explicit'].includes(v);

Prevention

When it happens

Trigger: A tool config like `foo = { source = "pipx", dependency_prereleases = true }` (boolean instead of string) is read by dependency_prereleases via validate_semantic / has_uv_only_options / uv_install_args.

Common situations: Writing the option as a boolean or number because other tools accept bare flags; copying a flag-style option from uv docs; typo mixing option styles in mise.toml.

Related errors


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

Appendix: source

Thrown at src/backend/pipx.rs:130

                };
                Ok(name.to_string())
            })
            .collect()
    }

    fn requirement_package_name(requirement: &str) -> Option<&str> {
        let name = requirement
            .trim()
            .split(|c: char| !(c.is_ascii_alphanumeric() || matches!(c, '-' | '_' | '.')))
            .next()
            .unwrap_or_default();
        (!name.is_empty()).then_some(name)
    }

    fn dependency_prereleases(&self) -> Result<Option<&'a str>> {
        let value = match self.values.raw().opts.get("dependency_prereleases") {
            Some(toml::Value::String(value)) => Some(value.as_str()),
            Some(_) => bail!("dependency_prereleases must be a string"),
            None => None,
        };
        if value.is_some_and(|value| {
            !matches!(value, "disallow" | "allow" | "if-necessary" | "explicit")
        }) {
            bail!("dependency_prereleases must be disallow, allow, if-necessary, or explicit");
        }
        Ok(value)
    }

    fn has_uv_only_options(&self) -> Result<bool> {
        Ok(!self.with()?.is_empty()
            || !self.expose()?.is_empty()
            || self.dependency_prereleases()?.is_some())
    }

    fn validate_semantic(&self) -> Result<()> {
        self.with()?;

View on GitHub (pinned to 533346cc37)