{"record":{"id":"32059323ea044a46","repo":"pola-rs/polars","slug":"path-argument-has-invalid-type-qualified-type-n","errorCode":null,"errorMessage":"`path` argument has invalid type {qualified_type_name(path)!r}, and cannot be turned into a sink target","messagePattern":"`path` argument has invalid type (.+?), and cannot be turned into a sink target","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/lazyframe/engine.py","lineNumber":62,"sourceCode":"\n\ndef _to_sink_target(\n    path: str | Path | IO[bytes] | IO[str] | PartitionBy,\n) -> str | Path | IO[bytes] | IO[str] | PartitionBy:\n    from polars.io.partition import PartitionBy\n\n    if isinstance(path, (str, Path)):\n        return normalize_filepath(path)\n    elif isinstance(path, io.IOBase):\n        return path\n    elif isinstance(path, PartitionBy):\n        return path\n    elif callable(getattr(path, \"write\", None)):\n        # This allows for custom writers\n        return path\n    else:\n        msg = f\"`path` argument has invalid type {qualified_type_name(path)!r}, and cannot be turned into a sink target\"\n        raise TypeError(msg)\n\n\nclass Engine(ABC):\n    \"\"\"\n    Base class for query execution engines.\n\n    Subclass this to plug a new backend into Polars.\n\n    .. warning::\n        This functionality is considered **unstable**. It may be changed\n        at any point without it being considered a breaking change.\n    \"\"\"\n\n    @property\n    @abstractmethod\n    def name(self) -> str:\n        \"\"\"Engine identifier.\"\"\"\n","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/pola-rs/polars/blob/68506541d2de983056c9eb244e1ea05fab377dfc/py-polars/src/polars/lazyframe/engine.py#L44-L80","documentation":"_to_sink_target conversion fallback: the sink `path` argument must be a str/Path, file-like IO object, PartitionBy spec, or an object with a .write method; anything else falls to the guard naming the invalid type. E.g. passing an int fd or None.","triggerScenarios":"Thrown at py-polars/src/polars/lazyframe/engine.py:63 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass path as a string, Path, or supported file-like object that can be turned into a sink target."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"68506541d2de983056c9eb244e1ea05fab377dfc","analyzedAt":"2026-08-28T18:02:35.179Z","contentChangedAt":"2026-08-28T18:02:35.179Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}