{"record":{"id":"8dd956d7b069356c","repo":"sqlalchemy/alembic","slug":"missing-required-positional-argument-s","errorCode":null,"errorMessage":"missing required positional argument: %s","messagePattern":"missing required positional argument: (.+?)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"alembic/util/langhelpers.py","lineNumber":178,"sourceCode":"                    if oldname in kw:\n                        warnings.warn(\n                            \"Argument %r is now named %r \"\n                            \"for method %s().\" % (oldname, newname, fn_name)\n                        )\n                        return_kw[newname] = kw.pop(oldname)\n                return_kw.update(kw)\n\n                args = list(args)\n                if spec[3]:\n                    pos_only = spec[0][: -len(spec[3])]\n                else:\n                    pos_only = spec[0]\n                for arg in pos_only:\n                    if arg not in return_kw:\n                        try:\n                            return_args.append(args.pop(0))\n                        except IndexError:\n                            raise TypeError(\n                                \"missing required positional argument: %s\"\n                                % arg\n                            )\n                return_args.extend(args)\n\n                return return_args, return_kw\n\n            globals_[\"_translate\"] = translate\n        else:\n            outer_args = \"*args, **kw\"\n            inner_args = \"*args, **kw\"\n            translate_str = \"\"\n\n        func_text = textwrap.dedent(\n            \"\"\"\\\n        def %(name)s(%(args)s):\n            %(doc)r\n            %(translate)s","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/sqlalchemy/alembic/blob/5551b5d35f985c99cb8f1af2b3c526b050e4c059/alembic/util/langhelpers.py#L160-L196","documentation":"Raised as TypeError by the _translate helper inside _create_method_proxy when a method using legacy argument name translations is called with too few positional arguments to fill a required positional-only parameter (langhelpers.py:173-181). This occurs specifically for methods decorated with @_with_legacy_names where old argument names are being mapped to new ones, and the caller hasn't supplied enough positional values.","triggerScenarios":"Calling an Alembic proxied method that has _legacy_translations defined, without passing enough positional arguments to cover all positional-only parameters. The translate function at langhelpers.py:168-181 pops from args for each pos_only param and raises TypeError on IndexError. This is an internal mechanism for backward-compatible argument renaming.","commonSituations":"Calling an Alembic API method with keyword arguments using old deprecated names while missing a required positional argument. Upgrading Alembic and hitting renamed parameters where the call site relied on positional ordering. Partial argument migration where some old names are used but positionals are incomplete.","solutions":["Check the method signature in the current Alembic docs/API and supply all required positional arguments.","If using deprecated argument names (which trigger a DeprecationWarning), switch to the new names.","Provide arguments explicitly as keyword arguments matching the current parameter names.","Inspect the full traceback to identify which method and which argument is missing."],"exampleFix":"# before (missing positional arg, using deprecated name)\nop.alter_column('users', 'name', nullable=True, oldname='full_name')\n# oldname is deprecated; missing table_name positional?\n\n# after (all required positionals, current arg names)\nop.alter_column('users', 'name', nullable=True, new_column_name='full_name')","handlingStrategy":"try-catch","validationCode":"import inspect\n\ndef has_required_args(fn, *args, **kwargs):\n    sig = inspect.signature(fn)\n    try:\n        sig.bind(*args, **kwargs)\n        return True\n    except TypeError:\n        return False","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check the current Alembic API signature before calling methods with positional arguments.","Replace deprecated argument names (which trigger DeprecationWarning) with current names.","When upgrading Alembic, review the changelog for renamed parameters."],"tags":["alembic","legacy-api","arguments","proxy","typeerror"],"backgroundTag":null,"analyzedSha":"5551b5d35f985c99cb8f1af2b3c526b050e4c059","analyzedAt":"2026-08-11T01:38:46.612Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}