{"record":{"id":"96212f057ce72852","repo":"BerriAI/litellm","slug":"expires-after-seconds-must-be-a-string-not-a-fil","errorCode":null,"errorMessage":"expires_after[seconds] must be a string, not a file upload","messagePattern":"expires_after\\[seconds\\] must be a string, not a file upload","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/openai_files_endpoints/files_endpoints.py","lineNumber":413,"sourceCode":"                    status_code=400,\n                    detail={\n                        \"error\": \"Both expires_after[anchor] and expires_after[seconds] must be provided if expires_after is specified\",\n                    },\n                )\n\n            # Validate expires_after[anchor] is a string (not UploadFile)\n            if isinstance(expires_after_anchor, UploadFile):\n                raise HTTPException(\n                    status_code=400,\n                    detail={\n                        \"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","sourceCodeStart":395,"sourceCodeEnd":431,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/openai_files_endpoints/files_endpoints.py#L395-L431","documentation":"HTTPException(400) on file upload: expires_after[seconds] is not a string — the multipart part is an UploadFile or other non-string value where a numeric string is expected. The client must send the seconds as a plain text form field.","triggerScenarios":"Thrown at litellm/proxy/openai_files_endpoints/files_endpoints.py:413 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Send expires_after[seconds] as a string form field, not a file upload."],"exampleFix":null,"handlingStrategy":"type-guard","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"}