{"id":"b280787f1c2143c3","repo":"python-poetry/poetry","slug":"setting-self-argument-key-does-not-exist","errorCode":null,"errorMessage":"Setting {self.argument('key')} does not exist","messagePattern":"Setting (.+?) does not exist","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/poetry/console/commands/config.py","lineNumber":367,"sourceCode":"            except PropertyNotFoundError:\n                settings = {}\n\n            for value in values:\n                if build_config_setting_validator(value):\n                    config_settings = build_config_setting_normalizer(value)\n                    for setting_name, item in config_settings.items():\n                        settings[setting_name] = item\n                else:\n                    raise ValueError(\n                        f\"Invalid build config setting '{value}'. \"\n                        \"It must be a valid JSON with each property a string or a list of strings.\"\n                    )\n\n            config.config_source.add_property(key, settings)\n\n            return 0\n\n        raise ValueError(f\"Setting {self.argument('key')} does not exist\")\n\n    def _handle_single_value(\n        self,\n        source: ConfigSource,\n        key: str,\n        callbacks: tuple[Any, Any],\n        values: list[Any],\n    ) -> int:\n        validator, normalizer = callbacks\n\n        if len(values) > 1:\n            raise RuntimeError(\"You can only pass one value.\")\n\n        value = values[0]\n        if not validator(value):\n            raise RuntimeError(f'\"{value}\" is an invalid value for {key}')\n\n        source.add_property(key, normalizer(value))","sourceCodeStart":349,"sourceCodeEnd":385,"githubUrl":"https://github.com/python-poetry/poetry/blob/92b74dcfe348d0e01e14d40d6c1fa47a4ee04a54/src/poetry/console/commands/config.py#L349-L385","documentation":"Fallback ValueError raised at config.py:367 when the config key matches none of the recognized patterns (`repositories.*`, `http-basic.*`, `pypi-token.*`, `certificates.*`, `installer.build-config-settings.*`) and is not in `unique_config_values`. It signals the user mistyped or invented a setting name.","triggerScenarios":"Running `poetry config typo.key value`, or `poetry config installer.max-workers` (note the dash vs the actual `installer.max-workers` may exist; any unknown root raises). Any key not enumerated in `unique_config_values` (config.py:78-101) and not matching a regex branch falls through.","commonSituations":"Typing a setting name from memory; using a setting removed in a newer Poetry version; mixing dashes and underscores.","solutions":["List valid settings with `poetry config --list` and copy the exact key.","Check the key against `unique_config_values` and the regex branches in `ConfigCommand.handle`.","For repositories, use the `repositories.<name>.url` form."],"exampleFix":"# before\npoetry config virtualenv.in-project true\n# after\npoetry config virtualenvs.in-project true","handlingStrategy":"validation","validationCode":"import re\nfrom poetry.console.commands.config import ConfigCommand\nKEY = \"virtualenvs.in-project\"\ncmd = ConfigCommand()\nknown = set(cmd.unique_config_values)\npatterns = [r\"repositories\\..+\", r\"http-basic\\..+\", r\"pypi-token\\..+\",\n            r\"certificates\\..+\\.(cert|client-cert)$\",\n            r\"installer\\.build-config-settings\\.[^.]+\"]\nassert KEY in known or any(re.match(p, KEY) for p in patterns), f\"unknown setting {KEY}\"","typeGuard":"def is_known_config_key(key: str) -> bool:\n    import re\n    patterns = [r\"repositories\\..+\", r\"http-basic\\..+\", r\"pypi-token\\..+\",\n                r\"certificates\\..+\\.(cert|client-cert)$\",\n                r\"installer\\.build-config-settings\\.[^.]+\"]\n    return key in known_keys or any(re.match(p, key) for p in patterns)","tryCatchPattern":null,"preventionTips":["Run `poetry config --list` to see canonical key names.","Copy keys from the Poetry docs for your exact version.","Wrap programmatic config edits in a key-allowlist check."],"tags":["config","cli-args","validation"],"analyzedSha":"92b74dcfe348d0e01e14d40d6c1fa47a4ee04a54","analyzedAt":"2026-08-04T20:33:34.072Z","schemaVersion":2}