{"record":{"id":"f8032833b189842d","repo":"pola-rs/polars","slug":"right-join-column-name-r-not-found","errorCode":null,"errorMessage":"right join column {name!r} not found","messagePattern":"right join column (.+?) not found","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/lazyframe/frame.py","lineNumber":9405,"sourceCode":"        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\"\n                raise ValueError(msg)\n\n        # no need to join if *only* join columns are in other (inner/left update only)\n        if how != \"full\" and len(right_schema) == len(right_on):\n            if row_index_name is not None:\n                return self.drop(row_index_name)\n            return self\n\n        # only use non-idx right columns present in left frame\n        right_other = set(right_schema).intersection(left_schema) - set(right_on)\n\n        # When include_nulls is True, we need to distinguish records after the join that\n        # were originally null in the right frame, as opposed to records that were null\n        # because the key was missing from the right frame.\n        # Add a validity column to track whether row was matched or not.\n        if include_nulls:\n            validity = (\"__POLARS_VALIDITY\",)\n            other = other.with_columns(F.lit(True).alias(validity[0]))\n        else:","sourceCodeStart":9387,"sourceCodeEnd":9423,"githubUrl":"https://github.com/pola-rs/polars/blob/df599052daf96e7a9cc30a3b0c6bd25d6947e3c0/py-polars/src/polars/lazyframe/frame.py#L9387-L9423","documentation":"LazyFrame.update resolves other.collect_schema() and validates every right_on (or `on`) name against the right frame's schema; an unknown right key raises ValueError naming it. Note: `on` must exist in BOTH frames, so this also fires when the shared key is missing only on the right.","triggerScenarios":"lf.update(other, on='id') where `other` lacks 'id'; right_on='key_r' typo; the update source was rebuilt/renamed and the key column changed.","commonSituations":"The `other` frame comes from a different pipeline (file, join result) with different column names; version change of an upstream producer.","solutions":["Check other.collect_schema() and fix right_on to the exact right-frame name","If names differ, set left_on/right_on explicitly instead of `on`","Rename in `other` first: other.rename({'old_key': 'id'})"],"exampleFix":"// before\nlf.update(other, on='id')  # other's key is 'user_id'\n\n// after\nlf.update(other, left_on='id', right_on='user_id')","handlingStrategy":"validation","validationCode":"right_keys = [on] if isinstance(on, str) else (on or right_on or [])\nright_schema = other.collect_schema()\nmissing = [c for c in right_keys if c not in right_schema]\nif missing:\n    raise KeyError(f'right keys not in schema: {missing}; have {list(right_schema)}')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate BOTH schemas before update; `on` requires the key in both frames"],"tags":["polars","update","join","schema","column-not-found"],"backgroundTag":null,"analyzedSha":"df599052daf96e7a9cc30a3b0c6bd25d6947e3c0","analyzedAt":"2026-08-16T12:10:03.978Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}