{"record":{"id":"efee0efffeadff44","repo":"pola-rs/polars","slug":"dataframe-how-must-be-one-of-allowed-got","errorCode":null,"errorMessage":"DataFrame `how` must be one of {{{allowed}}}, got {how!r}","messagePattern":"DataFrame `how` must be one of (.+?)\\}\\}, got (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/functions/eager.py","lineNumber":318,"sourceCode":"            out = wrap_df(plr.concat_df_diagonal(elems))\n        elif how == \"diagonal_relaxed\":\n            out = wrap_ldf(\n                plr.concat_lf_diagonal(\n                    [df.lazy() for df in elems],\n                    rechunk=rechunk,\n                    parallel=parallel,\n                    to_supertypes=True,\n                    maintain_order=True,\n                )\n            )._collect_eager(optimizations=QueryOptFlags._eager())\n        elif how == \"horizontal\":\n            out = wrap_df(plr.concat_df_horizontal(elems, strict=True))\n        elif how == \"horizontal_extend\":\n            out = wrap_df(plr.concat_df_horizontal(elems, strict=False))\n        else:\n            allowed = \", \".join(repr(m) for m in get_args(ConcatMethod))\n            msg = f\"DataFrame `how` must be one of {{{allowed}}}, got {how!r}\"\n            raise ValueError(msg)\n\n    elif is_non_empty_sequence_of(elems, pl.LazyFrame):\n        how = _normalize_horizontal_concat(\"concat\", how, strict=strict)\n\n        if how in (\"vertical\", \"vertical_relaxed\"):\n            return wrap_ldf(\n                plr.concat_lf(\n                    elems,\n                    rechunk=rechunk,\n                    parallel=parallel,\n                    to_supertypes=how.endswith(\"relaxed\"),\n                    maintain_order=True,\n                )\n            )\n        elif how in (\"diagonal\", \"diagonal_relaxed\"):\n            return wrap_ldf(\n                plr.concat_lf_diagonal(\n                    elems,","sourceCodeStart":300,"sourceCodeEnd":336,"githubUrl":"https://github.com/pola-rs/polars/blob/df599052daf96e7a9cc30a3b0c6bd25d6947e3c0/py-polars/src/polars/functions/eager.py#L300-L336","documentation":"For a sequence of DataFrames, pl.concat supports a fixed set of strategies — vertical, vertical_relaxed, diagonal, diagonal_relaxed, horizontal, horizontal_extend, plus the align family handled earlier in the function. Any other how value falls through to this ValueError, whose message enumerates the allowed ConcatMethod values.","triggerScenarios":"Typos like 'verticle' or 'vertical-relaxed'; how='cross' (not a concat strategy); a how value read from config/env/CLI that was never validated; a strategy that exists only for another input type.","commonSituations":"Config-driven concat strategies; version drift where strategy names changed or were added; copy-paste from docs of a different overload (LazyFrame vs DataFrame vs Series); user-supplied parameters in library wrappers.","solutions":["Use one of the allowed values exactly; the error message lists them","Validate config-supplied values before calling: check membership in typing.get_args(polars._typing.ConcatMethod)","Double-check the docs for the input type you are actually passing — supported strategies differ between DataFrame, LazyFrame, and Series"],"exampleFix":"# before\npl.concat(dfs, how='verticle')\n\n# after\npl.concat(dfs, how='vertical')\n\n# validating a dynamic value:\nfrom typing import get_args\nfrom polars._typing import ConcatMethod\nassert how in get_args(ConcatMethod), f'bad 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(dfs, 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 config-sourced strategy strings against the Literal type","Prefer passing the Literal values from code, not free-form strings","Check the DataFrame-specific strategy list; it differs from LazyFrame and Series"],"tags":["polars","concat","valueerror","argument-validation","config"],"backgroundTag":null,"analyzedSha":"df599052daf96e7a9cc30a3b0c6bd25d6947e3c0","analyzedAt":"2026-08-16T12:10:03.978Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}