apache/beam · error · TypeError
got too many positioned arguments.
Error message
{func.__name__} got too many positioned arguments. What it means
frame_base's function wrapper adapts Beam dataframe implementations to the pandas API signature (base_arg_names). It enforces that callers pass no more positional arguments than the pandas base method accepts, raising this TypeError to prevent arguments from silently being misassigned.
Solutions
- Remove the extra positional argument or convert it to a keyword argument that the pandas signature accepts.
- Check the current pandas signature of the method and update the call site.
- If calling the Beam-internal function, pass Beam-specific arguments as keywords rather than positionally.
Example fix
// before df.quantile(0.5, 0, 'linear') // after df.quantile(0.5, axis=0, interpolation='linear')
Defensive patterns
Strategy: validation
Validate before calling
import inspect n_base = len(inspect.signature(pd.DataFrame.quantile).parameters) assert len(args) <= n_base, 'too many positional arguments'
Type guard
def fits_base_signature(args, base_func) -> bool:
import inspect
return len(args) <= len(inspect.signature(base_func).parameters) Try / catch
try:
df.quantile(*args)
except TypeError as e:
if 'too many positioned' in str(e):
df.quantile(*args[:1], **kwargs)
else:
raise Prevention
- Call methods by keyword arguments to make arity errors impossible.
- Re-check positional args after pandas major-version upgrades.
- Avoid calling Beam's internal wrapped functions directly; use the public dataframe API.
When it happens
Trigger: Calling a dataframe method with excess positional args, e.g. df.quantile(0.5, 0, 'linear') passing more positionals than the pandas signature, or a Beam-internal shim invoking a wrapped function with stale extra positional arguments.
Common situations: Code written against an older pandas signature where extra positional args were tolerated; pandas 2.x changes that removed positional parameters; typos adding an extra argument; calling the Beam wrapper directly instead of through the public method.
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.
- ' ' is not yet supported
- is not implemented yet. If support for is important to you…
- \nConsider using an allow_non_parallel_operations block if…
- () got multiple values for argument
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/2a31b89605d5efe8.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/python/apache_beam/dataframe/frame_base.py:517
# We would need to add position only arguments if they ever become a thing
# in Pandas (as of 2.1 currently they aren't).
base_arg_spec = getfullargspec(unwrap(getattr(base_type, func.__name__)))
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
View on GitHub (pinned to 12126d8942)