{"id":"730963aef4a4350c","repo":"python-poetry/poetry","slug":"invalid-author-string-must-be-in-the-format-john","errorCode":null,"errorMessage":"Invalid author string. Must be in the format: John Smith <john@example.com>","messagePattern":"Invalid author string\\. Must be in the format: John Smith <john@example\\.com>","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/poetry/console/commands/init.py","lineNumber":510,"sourceCode":"                constraint.update(requirement)\n\n            requires[name] = constraint\n\n        return requires\n\n    @staticmethod\n    def _validate_author(author: str, default: str) -> str | None:\n        from poetry.core.utils.helpers import combine_unicode\n        from poetry.core.utils.patterns import AUTHOR_REGEX\n\n        author = combine_unicode(author or default)\n\n        if author in [\"n\", \"no\"]:\n            return None\n\n        m = AUTHOR_REGEX.match(author)\n        if not m:\n            raise ValueError(\n                \"Invalid author string. Must be in the format: \"\n                \"John Smith <john@example.com>\"\n            )\n\n        return author\n\n    @staticmethod\n    def _validate_package(package: str | None) -> str | None:\n        if package and len(package.split()) > 2:\n            raise ValueError(\"Invalid package definition.\")\n\n        return package\n\n    @staticmethod\n    def _validate_version_constraint(constraint: str | None) -> str | None:\n        from poetry.core.constraints.version import parse_constraint\n\n        constraint = (constraint or \"\").strip()","sourceCodeStart":492,"sourceCodeEnd":528,"githubUrl":"https://github.com/python-poetry/poetry/blob/92b74dcfe348d0e01e14d40d6c1fa47a4ee04a54/src/poetry/console/commands/init.py#L492-L528","documentation":"ValueError from `_validate_author` (init.py:508-513) when the author string (after unicode combining) does not match `AUTHOR_REGEX`, which expects `Name <email>`. Used by `poetry init` to populate `authors` in pyproject.toml.","triggerScenarios":"Entering `John Smith` without an email; `john@example.com` without a name; reversed order `john@example.com (John Smith)`; embedded newline or stray characters.","commonSituations":"Skipping the email during interactive init; pasting from a vCard; non-ASCII names that break the regex after `combine_unicode`.","solutions":["Use the exact format `John Smith <john@example.com>`.","Omit authors by entering `n` or `no` at the prompt.","For non-ASCII names, ensure the terminal is UTF-8 and the combined form still matches `Name <email>`."],"exampleFix":"# before\nJohn Smith, john@example.com\n# after\nJohn Smith <john@example.com>","handlingStrategy":"validation","validationCode":"import re\nfrom poetry.core.utils.patterns import AUTHOR_REGEX\nfrom poetry.core.utils.helpers import combine_unicode\nauthor = combine_unicode(\"John Smith <john@example.com>\")\nif not AUTHOR_REGEX.match(author):\n    raise SystemExit(\"author must be 'Name <email>'\")","typeGuard":"def is_valid_author(value: str) -> bool:\n    from poetry.core.utils.patterns import AUTHOR_REGEX\n    from poetry.core.utils.helpers import combine_unicode\n    return bool(AUTHOR_REGEX.match(combine_unicode(value or \"\")))","tryCatchPattern":null,"preventionTips":["Always include both display name and angle-bracketed email.","Enter `n`/`no` to skip authors.","For non-ASCII names, test the combined form through `AUTHOR_REGEX`."],"tags":["init","metadata","validation"],"analyzedSha":"92b74dcfe348d0e01e14d40d6c1fa47a4ee04a54","analyzedAt":"2026-08-04T20:33:34.072Z","schemaVersion":2}