{"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":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/functions/eager.py","lineNumber":361,"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":343,"sourceCodeEnd":379,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/functions/eager.py#L343-L379","documentation":"When concatenating LazyFrames, `how` must be one of the valid `ConcatMethod` literals supported by the lazy path; an unrecognized string raises a ValueError listing allowed values. This is the final else-branch of the LazyFrame dispatch in `concat`.","triggerScenarios":"Calling `pl.concat(lfs, how='HorizontalExtend')` or any misspelled/unsupported strategy on a list of LazyFrames after passing the eager-only checks.","commonSituations":"Typos in `how`; reusing a strategy string from a custom helper; confusion between eager-only and lazy-supported strategies after refactoring eager code to lazy.","solutions":["Use a valid strategy such as 'vertical', 'vertical_relaxed', 'diagonal', 'horizontal', 'align', etc.","Fix the typo/casing of `how`","Collect LazyFrames to DataFrames if a strictly eager-only strategy is required"],"exampleFix":"// before\npl.concat(lfs, how='vertical-relaxed')\n// after\npl.concat(lfs, how='vertical_relaxed')","handlingStrategy":"validation","validationCode":"allowed = {'vertical', 'vertical_relaxed', 'diagonal', 'horizontal', 'align', 'align_inner', 'align_full', 'align_left', 'align_right'}\nif how not in allowed:\n    raise ValueError(f'invalid how={how!r} for LazyFrame concat')","typeGuard":"def is_valid_lazy_how(how: str) -> bool:\n    return how in get_args(ConcatMethod)","tryCatchPattern":"try:\n    result = pl.concat(lfs, how=how)\nexcept ValueError as e:\n    if 'LazyFrame `how` must be one of' in str(e):\n        result = pl.concat(lfs, how='vertical')\n    else:\n        raise","preventionTips":["Type-annotate `how: ConcatMethod` so linters catch typos","Test lazy concat paths with each strategy used in production","Validate user-supplied strategy strings before dispatch"],"tags":["polars","lazyframe","concat","invalid-enum-value"],"backgroundTag":"invalid-enum-value","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"}