Spot the bug in the export endpoint

from Flask
Flask 3.1.3 / Python 3.14 intermediate 4 min 2 issues to find

Find the lifecycle bugs in this generated export endpoint.

Python
from threading import Thread
from flask import Flask, request

app = Flask(__name__)

def build_export(output_format):
    print(f"building {output_format}")

@app.post("/exports")
def start_export():
    thread = Thread(
        target=lambda: build_export(request.args["format"])
    )
    thread.start()
    return {"status": "queued"}, 202
Open in playground
Report an error