python-poetry/poetry · error · RuntimeError

You can only pass one value.

Error message

You can only pass one value.

What it means

RuntimeError from `_handle_single_value` (config.py:378-379) when a single-valued config key receives more than one positional value. Several settings (e.g. `virtualenvs.create`, `installer.parallel`, `requests.max-retries`) accept exactly one value; extras are rejected.

Source

Thrown at src/poetry/console/commands/config.py:379

                    )

            config.config_source.add_property(key, settings)

            return 0

        raise ValueError(f"Setting {self.argument('key')} does not exist")

    def _handle_single_value(
        self,
        source: ConfigSource,
        key: str,
        callbacks: tuple[Any, Any],
        values: list[Any],
    ) -> int:
        validator, normalizer = callbacks

        if len(values) > 1:
            raise RuntimeError("You can only pass one value.")

        value = values[0]
        if not validator(value):
            raise RuntimeError(f'"{value}" is an invalid value for {key}')

        source.add_property(key, normalizer(value))

        return 0

    def _list_configuration(
        self, config: dict[str, Any], raw: dict[str, Any], k: str = ""
    ) -> None:
        orig_k = k
        for key, value in sorted(config.items()):
            if k + key in self.LIST_PROHIBITED_SETTINGS:
                continue

            raw_val = raw.get(key)

View on GitHub (pinned to 92b74dcfe3)

Solutions

  1. Pass only one value: `poetry config virtualenvs.create true`.
  2. Quote any value that might word-split.
  3. For list-valued settings use the appropriate list normalizer key (e.g. `installer.no-binary`).

Example fix

# before
poetry config installer.parallel true false
# after
poetry config installer.parallel true
Defensive patterns

Strategy: validation

Validate before calling

values = args_after_key
if len(values) > 1:
    raise SystemExit(f"expected a single value, got {len(values)}: {values}")

Type guard

def is_at_most_one(values: list[str]) -> bool:
    return isinstance(values, list) and len(values) <= 1

Prevention

When it happens

Trigger: Running `poetry config virtualenvs.create true false` or any single-value key with two or more tokens.

Common situations: Append-style mistakes (assuming Poetry merges values); shell glob expanding to multiple tokens; copy-paste errors.

Related errors


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