{"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":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/functions/eager.py","lineNumber":233,"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":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/functions/eager.py#L215-L251","documentation":"The chosen concat `how` strategy only supports DataFrame and LazyFrame sequences; when the elements are some other type (e.g. Series or Expr), `concat` raises TypeError naming the actual element type. This is the align/horizontal dispatch branch validating element kinds.","triggerScenarios":"Calling `pl.concat([series1, series2], how='align')` or any align/horizontal strategy on elements that are not DataFrames or LazyFrames.","commonSituations":"Mixing Series and DataFrame inputs into one concat call; passing a list where items were accidentally unwrapped (e.g. a Series instead of a one-column DataFrame); copying a Series concat snippet and changing `how`.","solutions":["Use `how='vertical'` for Series concatenation","Convert Series to DataFrames before using align/horizontal strategies","Check the element type of the list before choosing a `how` strategy"],"exampleFix":"// before\npl.concat([s1, s2], how='align')\n// after\npl.concat([s1.to_frame('a'), s2.to_frame('b')], how='align')","handlingStrategy":"type-guard","validationCode":"if not all(isinstance(x, (pl.DataFrame, pl.LazyFrame)) for x in elems):\n    raise TypeError('align/horizontal concat requires DataFrames or LazyFrames')","typeGuard":"def are_frames(elems: list) -> bool:\n    return bool(elems) and all(isinstance(x, (pl.DataFrame, pl.LazyFrame)) for x in elems)","tryCatchPattern":"try:\n    result = pl.concat(elems, how='align')\nexcept TypeError as e:\n    result = pl.concat([x.to_frame() if isinstance(x, pl.Series) else x for x in elems], how='align')","preventionTips":["Check element types before choosing `how`","Convert Series with `.to_frame()` before frame-level concat","Avoid mixed-type element lists"],"tags":["polars","concat","type-mismatch","unsupported-strategy"],"backgroundTag":"incompatible-source-type","analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}