python config_error ai_generated true

AssertionError: A blueprint's name collision occurred between <Blueprint 'api'> and <Blueprint 'api'>. Either specify a unique name or register them under different prefixes.

ID: python/flask-blueprint-name-conflict

Also available as: JSON · Markdown · 中文
80%Fix Rate
88%Confidence
0Evidence
2025-07-30First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
2.x active — — —
3.x active — — —

Root Cause

Two Blueprint objects with the same name are registered on the same app, or a blueprint is registered twice.

generic

中文

两个同名 Blueprint 对象注册到同一个 app,或同一蓝图被注册两次。

Workarounds

  1. 95% success
    Give unique names: `api_v1 = Blueprint('api_v1', __name__)` and `api_v2 = Blueprint('api_v2', __name__)`.
  2. 90% success
    Register with a prefix: `app.register_blueprint(api, url_prefix='/v1')` and ensure names differ.

Dead Ends

Common approaches that don't work:

  1. 90% fail

    Name still collides; url_prefix does not change the blueprint name.

  2. 85% fail

    Second blueprint's routes are silently dropped.