python-poetry/poetry · error · ValueError

There is no {setting_key} setting.

Error message

There is no {setting_key} setting.

What it means

Raises ValueError in ConfigCommand.handle() when the user reads a setting key that does not match any known pattern (repositories, http-basic, pypi-token, certs, build-config-settings) and is not in unique_config_values. The check at line 206-207 fires in the read path's else branch, meaning the key is entirely unrecognized.

Source

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

                        )
                return 0
            elif m := re.match(repo_regex, self.argument("key")):
                if not m.group(1):
                    value = {}
                    if config.get("repositories") is not None:
                        value = config.get("repositories")
                else:
                    repo_name = m.group(1)
                    repo = config.get(["repositories", repo_name])
                    if repo is None:
                        raise ValueError(f"There is no {repo_name} repository defined")

                    value = repo.get(sub_key, "") if (sub_key := m.group(2)) else repo

                self.line(str(value))
            else:
                if setting_key not in self.unique_config_values:
                    raise ValueError(f"There is no {setting_key} setting.")

                value = config.get(setting_key)

                if not isinstance(value, str):
                    value = json.dumps(value)

                self.line(value)

            return 0

        values: list[str] = self.argument("value")

        if setting_key in self.unique_config_values:
            if self.option("unset"):
                config.config_source.remove_property(setting_key)
                return 0

            return self._handle_single_value(

View on GitHub (pinned to 92b74dcfe3)

Solutions

  1. List all valid settings: `poetry config --list` and compare against unique_config_values keys.
  2. Correct the setting key name (e.g. 'virtualenvs.in-project' not 'virtualenvs.inproject').

Example fix

# before (error)
poetry config virtualenvs.create-venv
# after
poetry config virtualenvs.create
Defensive patterns

Strategy: validation

Validate before calling

VALID_SETTINGS = {
    "cache-dir", "data-dir", "virtualenvs.create", "virtualenvs.in-project",
    "virtualenvs.options.always-copy", "virtualenvs.options.system-site-packages",
    "virtualenvs.options.no-pip", "virtualenvs.path", "virtualenvs.use-poetry-python",
    "virtualenvs.prompt", "system-git-client", "requests.max-retries",
    "installer.re-resolve", "installer.parallel", "installer.max-workers",
    "installer.no-binary", "installer.only-binary", "solver.lazy-wheel",
    "solver.min-release-age", "solver.min-release-age-exclude",
    "solver.min-release-age-exclude-source", "keyring.enabled", "python.installation-dir",
}

def validate_setting_key(key: str) -> None:
    if key not in VALID_SETTINGS:
        raise ValueError(f"Unknown setting '{key}'. Run 'poetry config --list' for valid keys.")

Type guard

def is_known_setting(key: str, valid_keys: set[str]) -> bool:
    return key in valid_keys

Prevention

When it happens

Trigger: Running `poetry config virtualenvs.something` or `poetry config foo.bar.baz` where 'foo.bar.baz' is neither a known setting nor a recognized config section.

Common situations: Typo in setting name, using a setting from a newer/older Poetry version, or guessing a setting name that doesn't exist.

Related errors


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