Skip to content

📝 Add clear error message for missing route tags in app/main.py.#2244

Open
rxxbyy wants to merge 1 commit intofastapi:masterfrom
rxxbyy:fix/route-tag-validation
Open

📝 Add clear error message for missing route tags in app/main.py.#2244
rxxbyy wants to merge 1 commit intofastapi:masterfrom
rxxbyy:fix/route-tag-validation

Conversation

@rxxbyy
Copy link

@rxxbyy rxxbyy commented Mar 25, 2026

Added a guard statement with a clear error message when a route is missing tags.

Currently, when you miss setting up a tag you get an error like:

return f"{route.tags[0]}-{route.name}"
          ~~~~~~~~~~^^^
IndexError: list index out of range

With the proposed changes, the developer sees:

ValueError: Route 'my_new_route' is missing a tag. Each route must have at least one tag for client generation.

I believe this improves developer experience and saves debugging time for anyone using the template.
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants