locustio/locust · error · ValueError

No tag name was supplied

Error message

No tag name was supplied

What it means

The @tag decorator requires at least one tag string argument. Calling @tag with no arguments (and not directly decorating a function) raises ValueError.

Source

Thrown at locust/user/task.py:139

                pass

            @tag('post')
            @task(11)
            def comment(self):
                pass
    """

    def decorator_func(decorated):
        if hasattr(decorated, "tasks"):
            decorated.tasks = list(map(tag(*tags), decorated.tasks))
        else:
            if "locust_tag_set" not in decorated.__dict__:
                decorated.locust_tag_set = set()
            decorated.locust_tag_set |= set(tags)
        return decorated

    if len(tags) == 0 or callable(tags[0]):
        raise ValueError("No tag name was supplied")

    return decorator_func


def get_tasks_from_base_classes(bases, class_dict):
    """
    Function used by both TaskSetMeta and UserMeta for collecting all declared tasks
    on the TaskSet/User class and all its base classes
    """
    new_tasks = []
    for base in bases:
        if hasattr(base, "tasks") and base.tasks:
            new_tasks += base.tasks

    if "tasks" in class_dict and class_dict["tasks"] is not None:
        tasks = class_dict["tasks"]
        if isinstance(tasks, dict):
            tasks = tasks.items()

View on GitHub (pinned to f391a716e1)

Solutions

  1. Supply at least one tag name: @tag("smoke")
  2. If you meant @task, use @task instead
  3. Remove the decorator if no tagging is needed

Example fix

// before
@tag()
def my_task(self):
    ...
// after
@tag("smoke")
def my_task(self):
    ...
Defensive patterns

Strategy: validation

Validate before calling

assert tags and all(isinstance(t, str) for t in tags), "@tag requires at least one tag name"

Prevention

When it happens

Trigger: @tag with an empty argument list, e.g. `@tag()` or bare `@tag` where the first positional arg is a callable (function) instead of a tag string.

Common situations: Typo like `@tag` instead of `@task`, or `@tag()` left without tag names when filtering tasks with --tags.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of locustio/locust@f391a716e1 (2026-08-29). Data as JSON: /api/errors/098c4c55edbdddc2. Report an issue: GitHub.