{"record":{"id":"821cf61126b9adca","repo":"BerriAI/litellm","slug":"f-invalid-sort-column-must-be-one-of-join","errorCode":null,"errorMessage":"f\"Invalid sort column. Must be one of: {', '.join(valid_columns)}\"","messagePattern":"f\"Invalid sort column\\. Must be one of: (.+?)\"","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/management_endpoints/internal_user_endpoints.py","lineNumber":1927,"sourceCode":"    return result\n\n\ndef _validate_sort_params(sort_by: str | None, sort_order: str) -> dict[str, str] | None:\n    order_by: Final[dict[str, str]] = {}\n\n    if sort_by is None:\n        return None\n    # Validate sort_by is a valid column\n    valid_columns: Final = [\n        \"user_id\",\n        \"user_email\",\n        \"created_at\",\n        \"spend\",\n        \"user_alias\",\n        \"user_role\",\n    ]\n    if sort_by not in valid_columns:\n        raise HTTPException(\n            status_code=400,\n            detail={\"error\": f\"Invalid sort column. Must be one of: {', '.join(valid_columns)}\"},\n        )\n\n    # Validate sort_order\n    if sort_order.lower() not in [\"asc\", \"desc\"]:\n        raise HTTPException(\n            status_code=400,\n            detail={\"error\": \"Invalid sort order. Must be 'asc' or 'desc'\"},\n        )\n\n    order_by[sort_by] = sort_order.lower()\n\n    return order_by\n\n\nasync def _authorize_user_list_request(\n    user_api_key_dict: UserAPIKeyAuth,","sourceCodeStart":1909,"sourceCodeEnd":1945,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/internal_user_endpoints.py#L1909-L1945","documentation":"Error \"f\"Invalid sort column. Must be one of: {', '.join(valid_columns)}\"\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/internal_user_endpoints.py:1927 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use one of the listed valid sort columns in the sort_by parameter.","Check the endpoint documentation for the exact set of sortable columns."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}