shaare.it

ValueError: Invalid blueprint name

7 Dec 2025

1 min read

ValueError: invalid blueprint name

$ flask run
Traceback (most recent call last):
  ...
ValueError: 'main/home' is not a valid blueprint name

Why this happens

Blueprint names can’t include slashes or invalid characters and must be unique across the app.

Fix

  • Use simple identifiers like main, auth, api and avoid special characters.

Wrong code

from flask import Blueprint
bp = Blueprint('main/home', __name__)  # invalid

Fixed code

from flask import Blueprint
bp = Blueprint('main', __name__)