deepset-ai/haystack · warning · DeprecationWarning

Warning: In an upcoming release, this method will require ke

Error message

Warning: In an upcoming release, this method will require keyword arguments for all parameters. Please update your code to use keyword arguments to ensure future compatibility. 

What it means

Haystack is deprecating positional argument calls on Pipeline methods (e.g. Pipeline.run, connect). The args_deprecated decorator (haystack/core/pipeline/utils.py:178) wraps these methods and, after executing, emits this DeprecationWarning when any positional args other than the Pipeline instance itself remain. In a future release such calls will raise TypeError, so callers must switch to keyword arguments now.

Source

Thrown at haystack/core/pipeline/utils.py:196

def args_deprecated(func: Callable[..., Any]) -> Callable[..., Any]:
    """
    Decorator to warn about the use of positional arguments in a function.

    Adapted from https://stackoverflow.com/questions/68432070/
    :param func:
    """

    def _positional_arg_warning() -> None:
        """
        Triggers a warning message if positional arguments are used in a function
        """
        import warnings

        msg = (
            "Warning: In an upcoming release, this method will require keyword arguments for all parameters. "
            "Please update your code to use keyword arguments to ensure future compatibility. "
        )
        warnings.warn(msg, DeprecationWarning, stacklevel=2)

    @wraps(func)
    def wrapper(*args: Any, **kwargs: Any) -> Any:
        # call the function first, to make sure the signature matches
        ret_value = func(*args, **kwargs)

        # A Pipeline instance is always the first argument - remove it from the args to check for positional arguments
        # We check the class name as strings to avoid circular imports
        if args and isinstance(args, tuple) and args[0].__class__.__name__ in ["Pipeline", "PipelineBase"]:
            args = args[1:]

        if args:
            _positional_arg_warning()
        return ret_value

    return wrapper

View on GitHub (pinned to e318778c9b)

Solutions

  1. Rewrite every decorated Pipeline method call to use keyword arguments, e.g. pipe.run(data={...}) instead of pipe.run({...})
  2. Check other positional parameters (e.g. include_outputs_from=..., receiver=..., sender=... for connect) and convert them to keywords
  3. Suppress temporarily with warnings.filterwarnings('ignore', category=DeprecationWarning, module='haystack') while migrating, but plan the rewrite before the next major release
  4. Run your test suite with -W error::DeprecationWarning to locate all offending call sites

Example fix

# before
result = pipe.run({"retriever": {"query": "hello"}}, max_retries=1)
pipe.connect("retriever.documents", "ranker.documents")
# after
result = pipe.run(data={"retriever": {"query": "hello"}}, max_retries=1)
pipe.connect(sender="retriever.documents", receiver="ranker.documents")
Defensive patterns

Strategy: validation

Validate before calling

import inspect

def uses_positional_args(pipe, *args, **kwargs):
    return bool(args)  # any positional arg beyond the Pipeline instance triggers the warning

# check before calling
if uses_positional_args(pipe, my_input_dict):
    # rewrite call to keyword form before invoking
    pipe.run(data=my_input_dict)

Type guard

import inspect
from haystack.core.pipeline import Pipeline

def is_pipeline_call_with_positionals(func, args: tuple) -> bool:
    params = inspect.signature(func).parameters
    names = list(params)
    # first positional should be the Pipeline instance ('self'); the rest must be keywords
    return any(isinstance(a, Pipeline) is False or i > 0 for i, a in enumerate(args) if i < len(names))

Prevention

When it happens

Trigger: Calling a decorated Pipeline method with positional arguments, e.g. pipe.run({'component': {'param': value}}) or pipe.connect('comp_a.output', 'comp_b.input') — anything after the Pipeline self argument triggers the warning.

Common situations: Upgrading Haystack and running existing code that passed pipeline inputs or connection endpoints positionally; tutorials or older snippets using pipe.run(inputs) with a dict; large codebases with many legacy Pipeline.run calls that only show the warning when DeprecationWarnings are not filtered.

Related errors


AI-assisted analysis of deepset-ai/haystack@e318778c9b (2026-08-30). Data as JSON: /api/errors/582e0463c02bacca. Report an issue: GitHub.