{"record":{"id":"bcd1cc8332ba4dc5","repo":"PaddlePaddle/PaddleOCR","slug":"file-url-and-file-path-are-mutually-exclusive","errorCode":null,"errorMessage":"file_url and file_path are mutually exclusive.","messagePattern":"file_url and file_path are mutually exclusive\\.","errorType":"validation","errorClass":"InvalidRequestError","httpStatus":null,"severity":"error","filePath":"paddleocr/_api_client/_core.py","lineNumber":42,"sourceCode":")\nfrom .models import (\n    DocParsingOptions,\n    Model,\n    OCROptions,\n    PaddleOCRVLOptions,\n    PPStructureV3Options,\n    is_document_parsing_model,\n    is_ocr_model,\n    is_vl_model,\n)\nfrom .results import BatchStatus, Job, JobStatus, Progress\n\n\ndef validate_input_source(file_url: Optional[str], file_path: Optional[str]) -> None:\n    if not file_url and not file_path:\n        raise InvalidRequestError(\"Either file_url or file_path is required.\")\n    if file_url and file_path:\n        raise InvalidRequestError(\"file_url and file_path are mutually exclusive.\")\n\n\ndef default_payload(model: Model) -> dict:\n    if is_ocr_model(model):\n        return OCROptions().to_payload()\n    return resolve_document_options(model, None).to_payload()\n\n\ndef resolve_ocr_model(model: Union[Model, str]) -> Model:\n    resolved = resolve_model(model)\n    if not is_ocr_model(resolved):\n        raise InvalidRequestError(f\"Unsupported OCR model: {model}\")\n    return resolved\n\n\ndef resolve_document_model(model: Union[Model, str]) -> Model:\n    resolved = resolve_model(model)\n    if not is_document_parsing_model(resolved):","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/PaddlePaddle/PaddleOCR/blob/2661c7c0ef5c613e8f93c6e93b2e052399f0f854/paddleocr/_api_client/_core.py#L24-L60","documentation":"Raised as InvalidRequestError by validate_input_source() when both file_url and file_path are provided. The API accepts exactly one input source per job; supplying both is ambiguous and is rejected client-side before any request is sent.","triggerScenarios":"Calling a submission method with non-None values for both file_url and file_path simultaneously.","commonSituations":"Copy-pasted config where a URL and a local path are both present, or fallback-style code like file_path=path or default_path that accidentally yields two truthy values.","solutions":["Keep exactly one input source; delete the other argument.","If you have both, decide which is authoritative (usually the local file) and drop the URL.","Add a pre-call check that at most one is set when inputs come from config."],"exampleFix":"# before\njob = client.create_ocr_job(file_url=url, file_path=local)  # InvalidRequestError\n\n# after\njob = client.create_ocr_job(file_path=local)","handlingStrategy":"validation","validationCode":"if file_url and file_path:\n    raise ValueError(\"pass only one of file_url or file_path\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never write fallback-style file_path=arg or default; pick one source explicitly.","Centralize input-source selection in one helper."],"tags":["validation","input","client-side"],"backgroundTag":null,"analyzedSha":"2661c7c0ef5c613e8f93c6e93b2e052399f0f854","analyzedAt":"2026-08-14T20:17:30.180Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}