{"id":"c90b100950e77c18","repo":"python-poetry/poetry","slug":"you-must-pass-exactly-1-value","errorCode":null,"errorMessage":"You must pass exactly 1 value","messagePattern":"You must pass exactly 1 value","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/poetry/console/commands/config.py","lineNumber":334,"sourceCode":"\n            if self.option(\"unset\"):\n                config.auth_config_source.remove_property(\n                    [\"certificates\", repository, key]\n                )\n\n                return 0\n\n            if len(values) == 1:\n                new_value: str | bool = values[0]\n\n                if key == \"cert\" and boolean_validator(values[0]):\n                    new_value = boolean_normalizer(values[0])\n\n                config.auth_config_source.add_property(\n                    [\"certificates\", repository, key], new_value\n                )\n            else:\n                raise ValueError(\"You must pass exactly 1 value\")\n\n            return 0\n\n        # handle build config settings\n        m = re.match(r\"installer\\.build-config-settings\\.([^.]+)\", self.argument(\"key\"))\n        if m:\n            key = f\"installer.build-config-settings.{canonicalize_name(m.group(1))}\"\n\n            if self.option(\"unset\"):\n                config.config_source.remove_property(key)\n                return 0\n\n            try:\n                settings = config.config_source.get_property(key)\n            except PropertyNotFoundError:\n                settings = {}\n\n            for value in values:","sourceCodeStart":316,"sourceCodeEnd":352,"githubUrl":"https://github.com/python-poetry/poetry/blob/92b74dcfe348d0e01e14d40d6c1fa47a4ee04a54/src/poetry/console/commands/config.py#L316-L352","documentation":"Raised by `poetry config certificates.<repo>.<cert|client-cert> <value>` when the number of positional values is not exactly one. The certificates handler at config.py:324-334 stores a single path (or boolean for `cert`) per call, so passing zero or multiple values is rejected. It guards the auth config source from writing a malformed certificates entry.","triggerScenarios":"Running `poetry config certificates.foo.cert` with no value, or `poetry config certificates.foo.cert a b` with two values. Also triggered by passing the value via a malformed shell expansion that yields zero tokens.","commonSituations":"Forgetting to append the path argument; copy-pasting a command that included two cert paths; shell quoting that splits a single path with spaces into multiple values.","solutions":["Pass exactly one value, e.g. `poetry config certificates.foo.cert /path/to/ca.pem`.","Quote paths containing spaces: `poetry config certificates.foo.cert \"/path with spaces/ca.pem\"`.","To remove the entry use `poetry config --unset certificates.foo.cert` instead of passing no value."],"exampleFix":"# before\npoetry config certificates.foo.cert\n# after\npoetry config certificates.foo.cert /etc/ssl/certs/foo-ca.pem","handlingStrategy":"validation","validationCode":"import sys\nvalues = sys.argv  # the positional values after the key\nif len(values) != 1:\n    raise SystemExit(\"pass exactly one value, e.g. certificates.<repo>.cert /path/to/cert\")","typeGuard":"def is_single_value(values: list[str]) -> bool:\n    return isinstance(values, list) and len(values) == 1 and bool(values[0])","tryCatchPattern":null,"preventionTips":["Quote paths containing spaces so the shell passes a single token.","Use `poetry config --unset` to remove an entry rather than omitting the value.","Build the command from a validated list of arguments in scripts."],"tags":["config","certificates","cli-args"],"analyzedSha":"92b74dcfe348d0e01e14d40d6c1fa47a4ee04a54","analyzedAt":"2026-08-04T20:33:34.072Z","schemaVersion":2}