{"record":{"id":"0aa5cb7d56b92f46","repo":"pola-rs/polars","slug":"lazyframe-how-must-be-one-of-allowed-got","errorCode":null,"errorMessage":"LazyFrame `how` must be one of {{{allowed}}}, got {how!r}","messagePattern":"LazyFrame `how` must be one of (.+?)\\}\\}, got (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/functions/eager.py","lineNumber":362,"sourceCode":"            return wrap_ldf(\n                plr.concat_lf_horizontal(\n                    elems,\n                    parallel=parallel,\n                    strict=True,\n                )\n            )\n        elif how == \"horizontal_extend\":\n            return wrap_ldf(\n                plr.concat_lf_horizontal(\n                    elems,\n                    parallel=parallel,\n                    strict=False,\n                )\n            )\n        else:\n            allowed = \", \".join(repr(m) for m in get_args(ConcatMethod))\n            msg = f\"LazyFrame `how` must be one of {{{allowed}}}, got {how!r}\"\n            raise ValueError(msg)\n\n    elif is_non_empty_sequence_of(elems, pl.Series):\n        if how == \"vertical\":\n            out = wrap_s(plr.concat_series(elems))\n        else:\n            msg = \"Series only supports 'vertical' concat strategy\"\n            raise ValueError(msg)\n\n    elif is_non_empty_sequence_of(elems, pl.Expr):\n        return wrap_expr(plr.concat_expr([e._pyexpr for e in elems], rechunk))\n    else:\n        msg = f\"did not expect type: {qualified_type_name(elems[0])!r} in `concat`\"\n        raise TypeError(msg)\n\n    if rechunk:\n        return out.rechunk()\n    return out\n","sourceCodeStart":344,"sourceCodeEnd":380,"githubUrl":"https://github.com/pola-rs/polars/blob/df599052daf96e7a9cc30a3b0c6bd25d6947e3c0/py-polars/src/polars/functions/eager.py#L344-L380","documentation":"The LazyFrame branch of pl.concat supports vertical, vertical_relaxed, diagonal, diagonal_relaxed, horizontal, and horizontal_extend (plus align strategies handled earlier); any other how value raises this ValueError listing the valid ConcatMethod values. The neighboring rule for Series sequences is even stricter: only 'vertical' is supported.","triggerScenarios":"pl.concat([lf1, lf2], how='horizonta') (typo); a strategy name valid for a different overload; how sourced from config or a function parameter and never validated; strategies removed or renamed across Polars versions.","commonSituations":"Dynamic how selection in data pipelines; wrapper libraries exposing a passthrough strategy parameter; version upgrades where supported strategy sets shifted.","solutions":["Use an allowed value exactly; the error message enumerates them","Validate dynamic values against typing.get_args(polars._typing.ConcatMethod) before the call","Confirm you are in the intended branch: collect()/lazy() the inputs if you meant to target a different frame type"],"exampleFix":"# before\npl.concat([lf1, lf2], how='horizontal-relaxed')\n\n# after\npl.concat([lf1, lf2], how='vertical_relaxed')\n\n# validating a dynamic value:\nfrom typing import get_args\nfrom polars._typing import ConcatMethod\nif how not in get_args(ConcatMethod):\n    raise ValueError(f'unsupported how: {how!r}')","handlingStrategy":"validation","validationCode":"from typing import get_args\nfrom polars._typing import ConcatMethod\n\nhow = (how or 'vertical').strip()\nif how not in get_args(ConcatMethod):\n    raise ValueError(f'unsupported concat how: {how!r}; allowed: {get_args(ConcatMethod)}')\nout = pl.concat(lazy_frames, how=how)","typeGuard":"from typing import get_args\nfrom polars._typing import ConcatMethod\n\ndef is_concat_method(x: object) -> bool:\n    return isinstance(x, str) and x in get_args(ConcatMethod)","tryCatchPattern":null,"preventionTips":["Validate strategy parameters once in the pipeline entry point","Remember Series only support 'vertical'","Re-validate literal sets after Polars upgrades since strategies evolve"],"tags":["polars","concat","lazyframe","valueerror","argument-validation"],"backgroundTag":null,"analyzedSha":"df599052daf96e7a9cc30a3b0c6bd25d6947e3c0","analyzedAt":"2026-08-16T12:10:03.978Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}