{"record":{"id":"beefecc7b44dae5c","repo":"pola-rs/polars","slug":"missing-join-columns-for-right-frame","errorCode":null,"errorMessage":"missing join columns for right frame","messagePattern":"missing join columns for right frame","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/lazyframe/frame.py","lineNumber":9054,"sourceCode":"            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()\n        for name in right_on:\n            if name not in right_schema:\n                msg = f\"right join column {name!r} not found\"","sourceCodeStart":9036,"sourceCodeEnd":9072,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/lazyframe/frame.py#L9036-L9072","documentation":"Mirror case of the left-frame key check: join raises ValueError when only one of left_on/right_on is supplied or the right frame's join columns cannot be resolved, leaving the right side without keys.","triggerScenarios":"Calling `lf.join(other, left_on=\"lid\")` with `on=None` and `right_on=None`.","commonSituations":"Key columns named differently between frames and only one side supplied; assuming right_on defaults to left_on.","solutions":["Add the matching `right_on=\"rcol\"` argument.","Or use `on=\"col\"` when the key column name is identical in both frames.","Pair left_on/right_on in helper functions to enforce completeness."],"exampleFix":"// before\nlf.join(other, left_on=\"lid\")\n// after\nlf.join(other, left_on=\"lid\", right_on=\"rid\")","handlingStrategy":"validation","validationCode":"if on is None and right_on is None and left_on is not None:\n    right_on = left_on\nout = lf.join(other, on=on, left_on=left_on, right_on=right_on, how=how)","typeGuard":null,"tryCatchPattern":"try:\n    out = lf.join(other, left_on=left_on, right_on=right_on, how=how)\nexcept ValueError as e:\n    if \"missing join columns for right frame\" in str(e):\n        out = lf.join(other, left_on=left_on, right_on=left_on, how=how)\n    else:\n        raise","preventionTips":["Default right_on to left_on when the right frame uses the same key name.","Pair left_on/right_on in function signatures.","Use `on=` instead of separate left_on/right_on when names match."],"tags":["python","polars","join","missing-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}