apache/beam · error · TypeError
() got multiple values for argument
Error message
%s() got multiple values for argument '%s'
What it means
The same signature-adapting wrapper zips positional args against base_arg_names and raises this standard-Python-style TypeError when a positional argument's name also appears in kwargs — i.e. the argument was supplied twice (once positionally, once by keyword). This prevents ambiguous duplicate bindings before invoking the Beam implementation.
Solutions
- Remove the duplicate keyword argument, keeping either the positional or keyword form.
- Build kwargs programmatically and assert no key collides with the positional names before calling.
- Update the call to match the pandas signature (positional args fill base_arg_names in order).
Example fix
// before df.quantile(0.5, q=0.5) // after df.quantile(0.5)
Defensive patterns
Strategy: validation
Validate before calling
import inspect
params = set(inspect.signature(func).parameters)
positional = set(inspect.signature(func).parameters)[:len(args)]
dupes = positional & kwargs.keys()
assert not dupes, f'duplicate argument: {dupes}' Type guard
def has_duplicate_binding(args, kwargs, func) -> bool:
import inspect
names = list(inspect.signature(func).parameters)[:len(args)]
return bool(set(names) & set(kwargs)) Try / catch
try:
df.quantile(0.5, q=0.5)
except TypeError as e:
if 'multiple values for argument' in str(e):
df.quantile(0.5)
else:
raise Prevention
- When refactoring calls, remove the positional arg when adding its keyword form.
- Build kwargs from config programmatically and check for collisions with positional slots.
- Prefer all-keyword calling style for dataframe methods to eliminate duplication.
When it happens
Trigger: Calling a dataframe method where the same parameter is passed both positionally and by keyword, e.g. df.quantile(0.5, q=0.5) or df.rolling(2, window=2) style collisions; also triggered by helpers that forward **kwargs after adding positional args.
Common situations: Refactored call sites that added a keyword arg without removing the positional one; generic wrapper code spreading kwargs over functions with positional defaults; dynamic argument construction from config where a key duplicates a positional slot.
Understand the failure class
Background: "must be a positive integer", "cannot be empty", "invalid argument": how invalid-argument errors work across open-source libraries — this error's family across 33 libraries.
Related errors
- Expression roots must have been created with to_dataframe.
- got too many positioned arguments.
- ' ' is not yet supported
- is not implemented yet. If support for is important to you…
- \nConsider using an allow_non_parallel_operations block if…
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/da86f061fffa5702.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/python/apache_beam/dataframe/frame_base.py:521
base_arg_names = base_arg_spec.args
# Some arguments are keyword only and we still want to check against those.
all_possible_base_arg_names = base_arg_names + base_arg_spec.kwonlyargs
beam_arg_names = getfullargspec(func).args
if not_found := (set(beam_arg_names) - set(all_possible_base_arg_names) -
set(removed_arg_names)):
raise TypeError(
f"Beam definition of {func.__name__} has arguments that are not found"
f" in the base version of the function: {not_found}")
@functools.wraps(func)
def wrapper(*args, **kwargs):
if len(args) > len(base_arg_names):
raise TypeError(f"{func.__name__} got too many positioned arguments.")
for name, value in zip(base_arg_names, args):
if name in kwargs:
raise TypeError(
"%s() got multiple values for argument '%s'" %
(func.__name__, name))
kwargs[name] = value
# Still have to populate these for the Beam function signature.
if removed_args:
for name in removed_args:
if name not in kwargs:
kwargs[name] = None
return func(**kwargs)
return wrapper
return wrap
BEAM_SPECIFIC = "Differences from pandas"
SECTION_ORDER = [View on GitHub (pinned to 12126d8942)