question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] RecursionError from response model

See original GitHub issue

Describe the bug

RecursionError from response model

  1. Create a file with:
from __future__ import annotations
from fastapi import FastAPI
from pydantic import BaseModel

class Response(BaseModel):
    children: 'Response'

Response.update_forward_refs()

app = FastAPI()
@app.get("/", response_model=Response)
def read_root():
    return {"Hello": "World"}
  1. start app and it throws a RecursionError

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
chris-allnuttcommented, May 6, 2020

This is a pydantic issue, not fastAPI https://github.com/samuelcolvin/pydantic/issues/1370

0reactions
tiangolocommented, Jun 6, 2020

Thanks for the help here everyone! 👏 🙇

Thanks for reporting back and closing the issue 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - About the maximum recursion error in FastAPI
I think I have found the answer, it is because of the addition of cross-domain caused by the use of middleware way to...
Read more >
Recursion Error While Handling Recursion Error
The correct answer here is “Which version of Python?” In Python 3, the interpreter freaks out and bails. >>> g() Fatal Python error:...
Read more >
Python RecursionError: Maximum Recursion Depth ...
You might have seen a Python RecursionError exception when running your Python code. Why does this happen? Is there a way to fix...
Read more >
maximum recursion depth exceeded while calling a Python ...
1、When running in Django, a bug appears as follows ... is all partial omission in the loop recursion error,So I've omitted some of...
Read more >
`RecursionError` when deleting a model instance in Admin
Dear forum, please consider these models: from django.db import models ... the constructor to be invoked again, causing the recursion error.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found