{"record":{"id":"68fb754765759ac1","repo":"pola-rs/polars","slug":"missing-join-columns-for-left-frame","errorCode":null,"errorMessage":"missing join columns for left frame","messagePattern":"missing join columns for left frame","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/lazyframe/frame.py","lineNumber":9383,"sourceCode":"            )\n\n        if how not in (\"left\", \"inner\", \"full\"):\n            msg = f\"`how` must be one of {{'left', 'inner', 'full'}}; found {how!r}\"\n            raise ValueError(msg)\n\n        row_index_name = None\n        if on is None:\n            if left_on is None and right_on is None:\n                # no keys provided--use row index\n                row_index_name = \"__POLARS_ROW_INDEX\"\n                self = self.with_row_index(row_index_name)\n                other = other.with_row_index(row_index_name)\n                left_on = right_on = [row_index_name]\n            else:\n                # one of left or right is missing, raise error\n                if left_on is None:\n                    msg = \"missing join columns for left frame\"\n                    raise ValueError(msg)\n                if right_on is None:\n                    msg = \"missing join columns for right frame\"\n                    raise ValueError(msg)\n        else:\n            # move on into left/right_on to simplify logic\n            left_on = right_on = on\n\n        if isinstance(left_on, str):\n            left_on = [left_on]\n        if isinstance(right_on, str):\n            right_on = [right_on]\n\n        left_schema = self.collect_schema()\n        for name in left_on:\n            if name not in left_schema:\n                msg = f\"left join column {name!r} not found\"\n                raise ValueError(msg)\n        right_schema = other.collect_schema()","sourceCodeStart":9365,"sourceCodeEnd":9401,"githubUrl":"https://github.com/pola-rs/polars/blob/df599052daf96e7a9cc30a3b0c6bd25d6947e3c0/py-polars/src/polars/lazyframe/frame.py#L9365-L9401","documentation":"In LazyFrame.update, when `on` is None you must specify the join keys via BOTH `left_on` and `right_on`. If only `right_on` is given, the left frame's key columns are unknown, so ValueError('missing join columns for left frame') is raised.","triggerScenarios":"lf.update(other, right_on='key') with neither `on` nor `left_on`; passing left_on=None explicitly while right_on is set (e.g. a half-refactored call).","commonSituations":"Renaming key arguments when frames use different key names and forgetting the counterpart; refactoring a join(left_on=..., right_on=...) call into update() and dropping one side.","solutions":["Provide both: lf.update(other, left_on='key_l', right_on='key_r')","Or use `on='key'` when the key name is identical in both frames","Audit shared helper code that conditionally passes only one of left_on/right_on"],"exampleFix":"// before\nlf.update(other, right_on='key_r')\n\n// after\nlf.update(other, left_on='key_l', right_on='key_r')","handlingStrategy":"validation","validationCode":"if on is None and ((left_on is None) != (right_on is None)):\n    raise ValueError(\n        'update needs `on`, or both `left_on` and `right_on`'\n    )","typeGuard":null,"tryCatchPattern":null,"preventionTips":["on=None means 'I will specify keys myself' in update(); supply the pair together","Prefer `on` for same-named keys to avoid asymmetric left_on/right_on bugs"],"tags":["polars","update","join","missing-argument"],"backgroundTag":null,"analyzedSha":"df599052daf96e7a9cc30a3b0c6bd25d6947e3c0","analyzedAt":"2026-08-16T12:10:03.978Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}