python runtime_error ai_generated true

ValueError: The name 'auth' is already registered for this blueprint. Use 'name=' to provide a unique name.

ID: python/flask-blueprint-name-collision

Also available as: JSON · Markdown · 中文
80%Fix Rate
87%Confidence
0Evidence
2025-02-10First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
2.x active
3.x active

Root Cause

Registering two blueprints with the same name in the same app.

generic

中文

在同一应用中注册了两个同名的蓝图。

Workarounds

  1. 95% success
    bp = Blueprint('auth_v2', __name__)
  2. 90% success
    app.register_blueprint(bp, name='auth_v2')

Dead Ends

Common approaches that don't work:

  1. 60% fail

    The blueprint's internal name attribute is what matters, not the variable.

  2. 90% fail

    Name collision still occurs.