{"record":{"id":"018f17254bc2d915","repo":"pola-rs/polars","slug":"how-r-strategy-is-not-supported-for-qualified-t","errorCode":null,"errorMessage":"{how!r} strategy is not supported for {qualified_type_name(elems[0])!r}","messagePattern":"(.+?) strategy is not supported for (.+?)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/functions/eager.py","lineNumber":234,"sourceCode":"    elems: Sequence[PolarsType] = list(items)\n\n    if not elems:\n        msg = \"cannot concat empty list\"\n        raise ValueError(msg)\n\n    if len(elems) == 1 and isinstance(\n        elems[0], (pl.DataFrame, pl.Series, pl.LazyFrame)\n    ):\n        return elems[0]\n\n    if how.startswith(\"align\"):\n        if not is_non_empty_sequence_of(\n            elems, pl.DataFrame\n        ) and not is_non_empty_sequence_of(  # type: ignore[redundant-expr]\n            elems, pl.LazyFrame\n        ):\n            msg = f\"{how!r} strategy is not supported for {qualified_type_name(elems[0])!r}\"\n            raise TypeError(msg)\n\n        # establish common columns, maintaining the order in which they appear\n        all_columns = list(chain.from_iterable(e.collect_schema() for e in elems))\n        key = {v: k for k, v in enumerate(ordered_unique(all_columns))}\n        output_column_order = list(key)\n        common_cols = sorted(\n            reduce(\n                lambda x, y: set(x) & set(y),  # type: ignore[arg-type, return-value]\n                chain(e.collect_schema() for e in elems),\n            ),\n            key=lambda k: key.get(k, 0),\n        )\n        # we require at least one key column for 'align' strategies\n        if not common_cols:\n            msg = f\"{how!r} strategy requires at least one common column\"\n            raise InvalidOperationError(msg)\n\n        # align frame data using a join, with no suffix-resolution (will raise","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/pola-rs/polars/blob/df599052daf96e7a9cc30a3b0c6bd25d6947e3c0/py-polars/src/polars/functions/eager.py#L216-L252","documentation":"The align / align_left / align_right / align_inner / align_full concat strategies align frames by joining on their common columns, which is only defined for all-DataFrame or all-LazyFrame input sequences. If the sequence contains Series, Expr, or mixed frame types, this TypeError names the first element's qualified type before any alignment runs.","triggerScenarios":"pl.concat([s1, s2], how='align') with Series inputs; mixing a DataFrame with a LazyFrame under an align strategy; passing a list of Expr with how='align_full'.","commonSituations":"Assuming align behaves like pandas concat(axis=1) for arbitrary objects; heterogeneous pipelines where one stage returns a Series instead of a DataFrame; forgetting .lazy()/to_frame() conversions before aligning.","solutions":["For Series inputs use how='vertical' (the only Series strategy)","Convert Series to named single-column frames first: s.to_frame(), then use align","Make all inputs the same kind: call .lazy() on every DataFrame (or collect every LazyFrame) before concat with an align strategy"],"exampleFix":"# before\npl.concat([s1, s2], how='align')\n\n# after\npl.concat([s1.to_frame(), s2.to_frame()], how='align')\n# or, if vertical stacking was intended:\npl.concat([s1, s2], how='vertical')","handlingStrategy":"validation","validationCode":"if how.startswith('align'):\n    if not all(isinstance(f, (pl.DataFrame, pl.LazyFrame)) for f in frames):\n        frames = [\n            f.to_frame() if isinstance(f, pl.Series) else f for f in frames\n        ]\n    assert all(type(f) is type(frames[0]) for f in frames), 'mixed frame types'\nout = pl.concat(frames, how=how)","typeGuard":"def all_frames_of_kind(xs: object) -> bool:\n    return bool(xs) and all(\n        isinstance(x, (pl.DataFrame, pl.LazyFrame)) and type(x) is type(xs[0])\n        for x in xs\n    )","tryCatchPattern":null,"preventionTips":["Convert Series to frames before align workflows","Keep pipelines homogeneous: all-eager or all-lazy","Reserve how='vertical' for Series sequences"],"tags":["polars","concat","align","typeerror","series"],"backgroundTag":null,"analyzedSha":"df599052daf96e7a9cc30a3b0c6bd25d6947e3c0","analyzedAt":"2026-08-16T12:10:03.978Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}