python-poetry/poetry · error · ValueError

Invalid config setting format: {config_setting}. Config sett

Error message

Invalid config setting format: {config_setting}. Config settings must be in the format 'key=value'

What it means

Raises ValueError in BuildCommand._prepare_config_settings() when a --config-settings (-c) argument does not contain an '=' character. Config settings must be passed in 'key=value' format so the method can partition on '=' to extract the key and value. The check at line 217 is `if '=' not in config_setting`.

Source

Thrown at src/poetry/console/commands/build.py:218

    @staticmethod
    def _prepare_config_settings(
        local_version: str | None, config_settings: list[str] | None, io: IO
    ) -> dict[str, str]:
        config_settings = config_settings or []
        result = {}

        if local_version:
            io.write_error_line(
                f"<warning>`<fg=yellow;options=bold>--local-version</>` is deprecated."
                f" Use `<fg=yellow;options=bold>--config-settings local-version={local_version}</>`"
                f" instead.</warning>"
            )
            result["local-version"] = local_version

        for config_setting in config_settings:
            if "=" not in config_setting:
                raise ValueError(
                    f"Invalid config setting format: {config_setting}. "
                    "Config settings must be in the format 'key=value'"
                )

            key, _, value = config_setting.partition("=")
            result[key] = value

        return result

    @staticmethod
    def _prepare_formats(fmt: str | None) -> list[str]:
        fmt = fmt or "all"

        return ["sdist", "wheel"] if fmt == "all" else [fmt]

    def handle(self) -> int:
        build_handler = BuildHandler(
            poetry=self.poetry,

View on GitHub (pinned to 92b74dcfe3)

Solutions

  1. Rewrite the argument in key=value form, e.g. `poetry build -c local-version=abc123`.
  2. If you need multiple settings, repeat -c for each: `poetry build -c key1=val1 -c key2=val2`.

Example fix

# before (error)
poetry build -c local-version
# after
poetry build -c local-version=abc123
Defensive patterns

Strategy: validation

Validate before calling

def validate_config_setting(setting: str) -> None:
    if "=" not in setting:
        raise ValueError(
            f"Config setting '{setting}' must be in 'key=value' format"
        )

Type guard

def is_valid_config_setting(setting: str) -> bool:
    return "=" in setting

Prevention

When it happens

Trigger: Running `poetry build -c foo` (no '=' sign), or `poetry build --config-settings local-version` without the '=value' portion. Any --config-settings entry missing the delimiter triggers this.

Common situations: User forgets the value portion, uses a space instead of '=' (which the shell would also misparse), or passes a flag-style argument by mistake.

Related errors


AI-assisted analysis of python-poetry/poetry@92b74dcfe3 (2026-08-04). Data as JSON: /data/errors/cbe5c15cb383724a.json. Report an issue: GitHub.