{"record":{"id":"3a66aa58a09f44b9","repo":"pathwaycom/pathway","slug":"received-direction-argument-of-join-that-is-a-st","errorCode":null,"errorMessage":"Received `direction` argument of join that is a string.\nYou probably want to use one of Direction.BACKWARD, Direction.FORWARD or Direction.NEAREST values.","messagePattern":"Received `direction` argument of join that is a string\\.\nYou probably want to use one of Direction\\.BACKWARD, Direction\\.FORWARD or Direction\\.NEAREST values\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/pathway/internals/arg_handlers.py","lineNumber":136,"sourceCode":"\n        if \"defaults\" in kwargs:\n            processed_kwargs[\"defaults\"] = kwargs.pop(\"defaults\")\n\n        if \"left_instance\" in kwargs and \"right_instance\" in kwargs:\n            processed_kwargs[\"left_instance\"] = kwargs.pop(\"left_instance\")\n            processed_kwargs[\"right_instance\"] = kwargs.pop(\"right_instance\")\n        elif \"left_instance\" in kwargs or \"right_instance\" in kwargs:\n            raise ValueError(\n                \"`left_instance` and `right_instance` arguments to join \"\n                + \"should always be provided simultaneously\"\n            )\n\n        if \"direction\" in kwargs:\n            direction = processed_kwargs[\"direction\"] = kwargs.pop(\"direction\")\n            from pathway.stdlib.temporal import Direction\n\n            if isinstance(direction, str):\n                raise ValueError(\n                    \"Received `direction` argument of join that is a string.\\n\"\n                    + \"You probably want to use one of \"\n                    + \"Direction.BACKWARD, Direction.FORWARD or Direction.NEAREST values.\"\n                )\n            if not isinstance(direction, Direction):\n                raise ValueError(\n                    \"direction argument of join should be of type asof_join.Direction.\"\n                )\n\n        if \"behavior\" in kwargs:\n            behavior = processed_kwargs[\"behavior\"] = kwargs.pop(\"behavior\")\n            from pathway.stdlib.temporal import CommonBehavior\n\n            if not isinstance(behavior, CommonBehavior):\n                raise ValueError(\n                    \"The behavior argument of join should be of type pathway.temporal.CommonBehavior.\"\n                )\n","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/internals/arg_handlers.py#L118-L154","documentation":"After the string case is handled, the join kwargs handler verifies that 'direction' is actually an instance of pathway.stdlib.temporal.Direction. Any other non-string object (int, None, a custom constant) fails this check and raises this ValueError stating the required type. It is the catch-all branch that guarantees direction is exactly a Direction enum member.","triggerScenarios":"direction=0 or direction=None passed explicitly; direction=Direction (the class itself instead of a member); custom sentinel objects intended as directions.","commonSituations":"Numeric direction codes from another system; defaulting direction to None meaning 'unspecified' instead of omitting the kwarg; passing the enum class rather than a member by forgetting the attribute access.","solutions":["Pass a Direction member: Direction.BACKWARD / Direction.FORWARD / Direction.NEAREST.","Omit the kwarg entirely to take the default instead of passing None.","Validate external direction inputs and map them to Direction members before the join."],"exampleFix":"# before\ndirection = Direction  # class, not member\npw.io.asof_join(left, right, left.time == right.time, direction=direction)\n\n# after\npw.io.asof_join(\n    left, right, left.time == right.time, direction=Direction.NEAREST\n)","handlingStrategy":"type-guard","validationCode":"from pathway.stdlib.temporal import Direction\n\nif direction is not None:\n    assert isinstance(direction, Direction), (\n        f\"direction must be a Direction member, got {type(direction).__name__}\"\n    )\nkwargs = {\"direction\": direction} if direction is not None else {}","typeGuard":"from pathway.stdlib.temporal import Direction\n\ndef is_direction_member(v) -> bool:\n    return isinstance(v, Direction)","tryCatchPattern":null,"preventionTips":["Pass Direction members, not the Direction class or numeric codes.","Omit the direction kwarg (rather than None) to use the default.","Validate external direction inputs before asof joins."],"tags":["join","asof-join","enum","type-error"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}