{"record":{"id":"ca18435ae0fd6932","repo":"pathwaycom/pathway","slug":"direction-argument-of-join-should-be-of-type-asof","errorCode":null,"errorMessage":"direction argument of join should be of type asof_join.Direction.","messagePattern":"direction argument of join should be of type asof_join\\.Direction\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/pathway/internals/arg_handlers.py","lineNumber":142,"sourceCode":"            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\n        if \"interval\" in kwargs:\n            from pathway.stdlib.temporal import Interval\n\n            interval = processed_kwargs[\"interval\"] = kwargs.pop(\"interval\")\n            if not isinstance(interval, Interval):\n                raise ValueError(","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/internals/arg_handlers.py#L124-L160","documentation":"Pathway's Table.join() argument preprocessor validates the `direction` kwarg used by as-of joins. `direction` must be a `pathway.stdlib.temporal.Direction` enum member (BACKWARD, FORWARD, NEAREST); strings or other objects are rejected before the join is built. Note the error text mentioning `asof_join.Direction` refers to the enum now exposed as `pw.temporal.Direction`.","triggerScenarios":"Calling pw.Table.join(..., direction=...) or Table.join_asof with direction=\"BACKWARD\" (a string), direction=True, or any non-Direction object. Passing the enum class itself (Direction) instead of a member (Direction.BACKWARD) also triggers it.","commonSituations":"Developers migrating from SQL-style APIs where direction is a string, or copy-pasting 'backward'/'forward' from docs examples; using asof_join with `mode`/`direction` parameters and assuming string literals like in pandas merge_asof.","solutions":["Import and use the enum: from pathway.stdlib.temporal import Direction, then pass direction=Direction.BACKWARD (or FORWARD/NEAREST).","If you passed a string like direction=\"backward\", replace it with the enum member.","If you typed direction=Direction (the class), use a member: Direction.BACKWARD."],"exampleFix":"# before\nt.join_asof(right, left_time, right_time, direction=\"BACKWARD\")\n\n# after\nfrom pathway.stdlib.temporal import Direction\nt.join_asof(right, left_time, right_time, direction=Direction.BACKWARD)","handlingStrategy":"type-guard","validationCode":"from pathway.stdlib.temporal import Direction\nassert isinstance(direction, Direction) and isinstance(direction, Direction), 'direction must be Direction.BACKWARD/FORWARD/NEAREST'","typeGuard":"from pathway.stdlib.temporal import Direction\n\ndef is_valid_direction(d) -> bool:\n    return isinstance(d, Direction)","tryCatchPattern":null,"preventionTips":["Always construct direction from the Direction enum, never from strings.","Centralize temporal-join kwargs in one helper so direction is validated once."],"tags":["pathway","join","asof-join","argument-validation","type-error"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}