{"record":{"id":"a7f76bb1f39ff109","repo":"BerriAI/litellm","slug":"error-converting-prompt-file-e","errorCode":null,"errorMessage":"Error converting prompt file: {e}","messagePattern":"Error converting prompt file: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"litellm/proxy/prompts/prompt_endpoints.py","lineNumber":1360,"sourceCode":"        temp_file_path = Path(tempfile.mkdtemp()) / safe_filename(file.filename)\n        temp_file_path.write_bytes(file_content)\n\n        # Create a PromptManager instance just for conversion\n        prompt_manager: Final = PromptManager()\n\n        # Convert to JSON\n        json_data: Final = prompt_manager.prompt_file_to_json(temp_file_path)\n\n        # Extract prompt ID from filename\n        prompt_id: Final = temp_file_path.stem\n\n        return {\n            \"prompt_id\": prompt_id,\n            \"json_data\": json_data,\n        }\n\n    except Exception as e:\n        raise HTTPException(status_code=500, detail=f\"Error converting prompt file: {e}\")\n\n    finally:\n        # Clean up temp file\n        if temp_file_path and temp_file_path.exists():\n            temp_file_path.unlink()\n            # Also try to remove the temp directory if it's empty\n            try:\n                temp_file_path.parent.rmdir()\n            except OSError:\n                pass  # Directory not empty or other error\n","sourceCodeStart":1342,"sourceCodeEnd":1371,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/prompts/prompt_endpoints.py#L1342-L1371","documentation":"Catch-all from the prompt-file conversion endpoint: writing the upload to a temp file or running PromptManager.prompt_file_to_json over it raised (malformed frontmatter, unreadable content, or filesystem error); the original exception text is embedded in the 400/500 detail.","triggerScenarios":"Thrown at litellm/proxy/prompts/prompt_endpoints.py:1360 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the .prompt file syntax per the error detail (frontmatter YAML, template placeholders) and re-upload."],"exampleFix":null,"handlingStrategy":"try-catch","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-14T05:17:10.506Z"}