{"id":"b1d1b3e645404c2c","repo":"python-poetry/poetry","slug":"expected-a-value-for-setting-key-setting","errorCode":null,"errorMessage":"Expected a value for {setting_key} setting.","messagePattern":"Expected a value for (.+?) setting\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/poetry/console/commands/config.py","lineNumber":168,"sourceCode":"\n        if self.option(\"list\"):\n            self._list_configuration(config.all(), config.raw())\n\n            return 0\n\n        setting_key = self.argument(\"key\")\n        if not setting_key:\n            return 0\n\n        if self.argument(\"value\") and self.option(\"unset\"):\n            raise RuntimeError(\"You can not combine a setting value with --unset\")\n\n        repo_regex = r\"^repos?(?:itories)?(?:\\.(.+?)(?:\\.(url))?)?$\"\n\n        # show the value if no value is provided\n        if not self.argument(\"value\") and not self.option(\"unset\"):\n            if setting_key.split(\".\")[0] in self.LIST_PROHIBITED_SETTINGS:\n                raise ValueError(f\"Expected a value for {setting_key} setting.\")\n\n            value: str | dict[str, Any] | list[str]\n\n            if m := re.match(\n                r\"installer\\.build-config-settings(\\.([^.]+))?\", self.argument(\"key\")\n            ):\n                if not m.group(1):\n                    if value := config.get(\"installer.build-config-settings\"):\n                        self._list_configuration(value, value)\n                    else:\n                        self.line(\"No packages configured with build config settings.\")\n                else:\n                    package_name = canonicalize_name(m.group(2))\n                    key = f\"installer.build-config-settings.{package_name}\"\n\n                    if value := config.get(key):\n                        self.line(json.dumps(value))\n                    else:","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/python-poetry/poetry/blob/92b74dcfe348d0e01e14d40d6c1fa47a4ee04a54/src/poetry/console/commands/config.py#L150-L186","documentation":"Raises ValueError in ConfigCommand.handle() when the user reads (without providing a value) a setting whose top-level key is in LIST_PROHIBITED_SETTINGS ({'http-basic', 'pypi-token'}). These are secret-bearing settings that Poetry never displays, so reading them without a value to set is treated as an error to prevent accidental secret exposure. The check at line 167-168 fires when no value is provided and the key starts with a prohibited segment.","triggerScenarios":"Running `poetry config http-basic.pypi` or `poetry config pypi-token.pypi` without passing a value and without --unset. The command interprets this as a read attempt on a secret setting.","commonSituations":"User tries to inspect a stored credential, or forgets to append the username/password/token value when setting it.","solutions":["Provide the value when setting: `poetry config http-basic.pypi username password` or `poetry config pypi-token.pypi <token>`.","Use --unset to remove the credential: `poetry config http-basic.pypi --unset`.","Poetry intentionally does not allow reading back secrets; use your keyring or OS credential store to inspect stored values."],"exampleFix":"# before (error)\npoetry config pypi-token.pypi\n# after (to set)\npoetry config pypi-token.pypi pypi-xxxxxxxx","handlingStrategy":"validation","validationCode":"PROHIBITED = {\"http-basic\", \"pypi-token\"}\n\ndef validate_config_read(key: str, has_value: bool) -> None:\n    if not has_value and key.split(\".\")[0] in PROHIBITED:\n        raise ValueError(\n            f\"Reading '{key}' is not allowed; provide a value to set or use --unset\"\n        )","typeGuard":"PROHIBITED = {\"http-basic\", \"pypi-token\"}\n\ndef is_safe_config_read(key: str, has_value: bool) -> bool:\n    return has_value or key.split(\".\")[0] not in PROHIBITED","tryCatchPattern":null,"preventionTips":["Always provide a value when configuring http-basic or pypi-token settings.","Poetry deliberately blocks reading back secrets; use your OS keyring to inspect stored credentials.","Use --unset to remove credentials you no longer need."],"tags":["config-command","valueerror","secrets","http-basic","pypi-token","security"],"analyzedSha":"92b74dcfe348d0e01e14d40d6c1fa47a4ee04a54","analyzedAt":"2026-08-04T20:33:34.072Z","schemaVersion":2}