{"record":{"id":"0470e006662fdf31","repo":"PaddlePaddle/PaddleOCR","slug":"unknown-argument-name","errorCode":null,"errorMessage":"Unknown argument: {name}","messagePattern":"Unknown argument: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"paddleocr/_common_args.py","lineNumber":54,"sourceCode":"\n\ndef parse_common_args(kwargs, *, default_enable_hpi):\n    default_vals = {\n        \"device\": DEFAULT_DEVICE,\n        \"engine\": None,\n        \"engine_config\": None,\n        \"enable_hpi\": default_enable_hpi,\n        \"use_tensorrt\": DEFAULT_USE_TENSORRT,\n        \"precision\": DEFAULT_PRECISION,\n        \"enable_mkldnn\": DEFAULT_ENABLE_MKLDNN,\n        \"mkldnn_cache_capacity\": DEFAULT_MKLDNN_CACHE_CAPACITY,\n        \"cpu_threads\": DEFAULT_CPU_THREADS,\n        \"enable_cinn\": DEFAULT_USE_CINN,\n    }\n\n    unknown_names = kwargs.keys() - default_vals.keys()\n    for name in unknown_names:\n        raise ValueError(f\"Unknown argument: {name}\")\n\n    kwargs = {**default_vals, **kwargs}\n\n    if (\n        kwargs[\"engine\"] is not None\n        and kwargs[\"engine\"] not in SUPPORTED_INFERENCE_ENGINE_LIST\n    ):\n        raise ValueError(\n            f\"Invalid engine: {kwargs['engine']}. Supported values are: {SUPPORTED_INFERENCE_ENGINE_LIST}.\"\n        )\n\n    if kwargs[\"precision\"] not in SUPPORTED_PRECISION_LIST:\n        raise ValueError(\n            f\"Invalid precision: {kwargs['precision']}. Supported values are: {SUPPORTED_PRECISION_LIST}.\"\n        )\n\n    kwargs[\"use_pptrt\"] = kwargs.pop(\"use_tensorrt\")\n    kwargs[\"pptrt_precision\"] = kwargs.pop(\"precision\")","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/PaddlePaddle/PaddleOCR/blob/2661c7c0ef5c613e8f93c6e93b2e052399f0f854/paddleocr/_common_args.py#L36-L72","documentation":"ValueError raised by parse_common_args when kwargs contain a key that is not in the known set of common inference arguments (device, engine, engine_config, enable_hpi, use_tensorrt, precision, enable_mkldnn, mkldnn_cache_capacity, cpu_threads, enable_cinn). It catches typos and renamed parameters before pipeline construction.","triggerScenarios":"Calling PaddleOCR(..., devise='gpu') (typo), or passing arguments removed/renamed in the current version (e.g. use_tensorrt renamed to enable_tensorrt in an older/newer release), or passing model-specific kwargs into the common-arg parser.","commonSituations":"Upgrading paddleocr versions where argument names changed; copy-pasting kwargs from examples for a different version; passing pipeline-specific options at the wrong level.","solutions":["Check the spelling of every keyword against the error message (the first unknown name is reported)","Compare with the supported list: device, engine, engine_config, enable_hpi, use_tensorrt, precision, enable_mkldnn, mkldnn_cache_capacity, cpu_threads, enable_cinn","If the arg was renamed across versions, update it (e.g. use_tensorrt in this version, use_pptrt internally)","Move model/pipeline-specific options to the API that accepts them"],"exampleFix":"# before\nocr = PaddleOCR(devise='gpu')\n# after\nocr = PaddleOCR(device='gpu')","handlingStrategy":"validation","validationCode":"from paddleocr._common_args import parse_common_args\n\nKNOWN = {'device','engine','engine_config','enable_hpi','use_tensorrt','precision','enable_mkldnn','mkldnn_cache_capacity','cpu_threads','enable_cinn'}\nunknown = set(user_kwargs) - KNOWN\nif unknown:\n    raise ValueError(f'unknown args: {sorted(unknown)}')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep all pipeline kwargs in one config dict validated once","Re-check argument names after upgrading paddleocr","Enable static checking by passing kwargs explicitly, not via ** spread of untrusted dicts"],"tags":["validation","configuration","kwargs"],"backgroundTag":null,"analyzedSha":"2661c7c0ef5c613e8f93c6e93b2e052399f0f854","analyzedAt":"2026-08-14T20:17:30.180Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}