{"record":{"id":"1a6fe4436fbeb464","repo":"BerriAI/litellm","slug":"expires-after-anchor-must-be-created-at-got","errorCode":null,"errorMessage":"expires_after[anchor] must be 'created_at', got '{expires_after_anchor}'","messagePattern":"expires_after\\[anchor\\] must be 'created_at', got '(.+?)'","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/openai_files_endpoints/files_endpoints.py","lineNumber":424,"sourceCode":"                        \"error\": \"expires_after[anchor] must be a string, not a file upload\",\n                    },\n                )\n\n            # Validate expires_after[seconds] is a string (not UploadFile)\n            # Use positive isinstance check for proper type narrowing (matches codebase pattern)\n            if not isinstance(expires_after_seconds_str, str):\n                raise HTTPException(\n                    status_code=400,\n                    detail={\n                        \"error\": \"expires_after[seconds] must be a string, not a file upload\",\n                    },\n                )\n            # After this check, mypy knows expires_after_seconds_str is str\n            expires_after_seconds_str_validated: Final[str] = expires_after_seconds_str\n\n            # Validate anchor is \"created_at\"\n            if expires_after_anchor != \"created_at\":\n                raise HTTPException(\n                    status_code=400,\n                    detail={\n                        \"error\": f\"expires_after[anchor] must be 'created_at', got '{expires_after_anchor}'\",\n                    },\n                )\n\n            # Convert seconds to int\n            try:\n                expires_after_seconds: Final = int(expires_after_seconds_str_validated)\n            except (ValueError, TypeError) as e:\n                raise HTTPException(\n                    status_code=400,\n                    detail={\n                        \"error\": f\"expires_after[seconds] must be a valid integer, got '{expires_after_seconds_str}': {e}\",\n                    },\n                )\n\n            # Use literal \"created_at\" (not variable) for TypedDict to satisfy Literal type","sourceCodeStart":406,"sourceCodeEnd":442,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/openai_files_endpoints/files_endpoints.py#L406-L442","documentation":"HTTPException(400) on file upload: the expires_after[anchor] value is not the only supported anchor, 'created_at' (e.g. 'fixed_time' or a typo). Expiry is only definable relative to file creation, so any other anchor is rejected with the offending value echoed.","triggerScenarios":"Thrown at litellm/proxy/openai_files_endpoints/files_endpoints.py:424 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set expires_after[anchor] to 'created_at'."],"exampleFix":null,"handlingStrategy":"validation","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"}