{"record":{"id":"c95ee4186522c8ee","repo":"pallets/flask","slug":"endpoint-may-not-contain-a-dot-character","errorCode":null,"errorMessage":"'endpoint' may not contain a dot '.' character.","messagePattern":"'endpoint' may not contain a dot '\\.' character\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/flask/sansio/blueprints.py","lineNumber":428,"sourceCode":"        extend(self.template_context_processors, app.template_context_processors)\n\n    @setupmethod\n    def add_url_rule(\n        self,\n        rule: str,\n        endpoint: str | None = None,\n        view_func: ft.RouteCallable | None = None,\n        provide_automatic_options: bool | None = None,\n        **options: t.Any,\n    ) -> None:\n        \"\"\"Register a URL rule with the blueprint. See :meth:`.Flask.add_url_rule` for\n        full documentation.\n\n        The URL rule is prefixed with the blueprint's URL prefix. The endpoint name,\n        used with :func:`url_for`, is prefixed with the blueprint's name.\n        \"\"\"\n        if endpoint and \".\" in endpoint:\n            raise ValueError(\"'endpoint' may not contain a dot '.' character.\")\n\n        if view_func and hasattr(view_func, \"__name__\") and \".\" in view_func.__name__:\n            raise ValueError(\"'view_func' name may not contain a dot '.' character.\")\n\n        self.record(\n            lambda s: s.add_url_rule(\n                rule,\n                endpoint,\n                view_func,\n                provide_automatic_options=provide_automatic_options,\n                **options,\n            )\n        )\n\n    @t.overload\n    def app_template_filter(self, name: T_template_filter) -> T_template_filter: ...\n    @t.overload\n    def app_template_filter(","sourceCodeStart":410,"sourceCodeEnd":446,"githubUrl":"https://github.com/pallets/flask/blob/3596b1ab61cea85edb8970e83ff61daa073facf8/src/flask/sansio/blueprints.py#L410-L446","documentation":"Blueprint.add_url_rule rejects an endpoint containing '.' because the dot is reserved as the separator between blueprint name and endpoint (final endpoint becomes 'bp.endpoint'). A dot in the user-supplied endpoint would break url_for and theBlueprint prefixing logic. Raises ValueError.","triggerScenarios":"Passing endpoint='users.list' to @bp.route(...); deriving endpoint from a dotted qualified name; copy-pasting an app-level dotted endpoint into a blueprint route.","commonSituations":"Migrating app routes into a blueprint without renaming endpoints; using fully-qualified function names as endpoints; blueprint factories templating endpoints with dots.","solutions":["Remove dots from the endpoint argument: endpoint='list' instead of 'users.list'.","Let Flask default the endpoint from the view function's __name__ (ensure that name has no dot, see error 49).","Replace separators: endpoint.replace('.', '_')."],"exampleFix":"// before\n@bp.route('/list', endpoint='users.list')\ndef list_users(): ...\n\n// after\n@bp.route('/list', endpoint='list')\ndef list_users(): ...","handlingStrategy":"validation","validationCode":"def validate_endpoint(endpoint: str | None) -> str | None:\n    if endpoint and '.' in endpoint:\n        raise ValueError(\"endpoint must not contain '.'\")\n    return endpoint\n","typeGuard":"def endpoint_is_dot_free(endpoint) -> bool:\n    return endpoint is None or '.' not in endpoint\n","tryCatchPattern":null,"preventionTips":["Use plain identifier endpoints inside blueprints.","Let Flask default the endpoint from the function name when possible.","Lint for endpoint='...'\".\"...'."],"tags":["flask","blueprint","endpoint","validation","naming"],"backgroundTag":null,"analyzedSha":"3596b1ab61cea85edb8970e83ff61daa073facf8","analyzedAt":"2026-08-11T20:11:52.622Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}