{"record":{"id":"0faf3e5ed953256e","repo":"opendatalab/MinerU","slug":"invalid-mineru-api-max-concurrent-requests-value","errorCode":null,"errorMessage":"Invalid MINERU_API_MAX_CONCURRENT_REQUESTS value: {value}. Expected a positive integer.","messagePattern":"Invalid MINERU_API_MAX_CONCURRENT_REQUESTS value: (.+?)\\. Expected a positive integer\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mineru/utils/config_reader.py","lineNumber":183,"sourceCode":"        logger.warning(\n            f\"Invalid MINERU_PROCESSING_WINDOW_SIZE value: {value}, use default {default}\"\n        )\n        return default\n    return max(1, window_size)\n\n\ndef get_max_concurrent_requests(default: int = 3) -> int:\n    if default <= 0:\n        raise ValueError(\n            f\"default max_concurrent_requests must be a positive integer, got {default}\"\n        )\n    value = os.getenv('MINERU_API_MAX_CONCURRENT_REQUESTS')\n    if value is None:\n        return default\n    try:\n        max_concurrent_requests = int(value)\n    except ValueError as exc:\n        raise ValueError(\n            \"Invalid MINERU_API_MAX_CONCURRENT_REQUESTS value: \"\n            f\"{value}. Expected a positive integer.\"\n        ) from exc\n    if max_concurrent_requests <= 0:\n        raise ValueError(\n            \"Invalid MINERU_API_MAX_CONCURRENT_REQUESTS value: \"\n            f\"{value}. Expected a positive integer.\"\n        )\n    return max_concurrent_requests\n\n\ndef get_latex_delimiter_config():\n    config = read_config()\n    if config is None:\n        return None\n    latex_delimiter_config = config.get('latex-delimiter-config', None)\n    if latex_delimiter_config is None:\n        # logger.warning(f\"'latex-delimiter-config' not found in {CONFIG_FILE_NAME}, use 'None' as default\")","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/opendatalab/MinerU/blob/4fe4bde114a23ee5dd637eae99b767f4669bf58c/mineru/utils/config_reader.py#L165-L201","documentation":"Raised by MineRU's get_max_concurrent_requests() when the environment variable MINERU_API_MAX_CONCURRENT_REQUESTS is set to a string that int() cannot parse (e.g. 'three', '2.5', '' or '2,'). The default (3) is only used when the variable is unset; any set-but-malformed value is treated as a configuration error rather than silently ignored.","triggerScenarios":"Exporting MINERU_API_MAX_CONCURRENT_REQUESTS with a non-integer value (export MINERU_API_MAX_CONCURRENT_REQUESTS=2.5, =three, or an empty/whitespace string) and then invoking any MineRU API-client code path that calls get_max_concurrent_requests().","commonSituations":"Quotes or spaces left in a value set in .bashrc/.env/docker-compose; a value copied from documentation that includes units or decimals; CI secrets injecting an empty string for the variable; YAML unquoted '2.5' parsed as a float and stringified.","solutions":["Set the variable to a plain positive integer string: export MINERU_API_MAX_CONCURRENT_REQUESTS=4.","If you want the default behavior, unset the variable entirely (unset MINERU_API_MAX_CONCURRENT_REQUESTS) rather than setting it to an empty string.","Check for stray whitespace/quotes in .env files, docker-compose environment blocks, and Kubernetes manifests — the value must be an exact integer literal.","Avoid decimals ('2.0') and thousands separators; the parser is strict int(), not float()."],"exampleFix":"# before\nexport MINERU_API_MAX_CONCURRENT_REQUESTS=\"4 \"   # or =2.5, =four\n\n# after\nexport MINERU_API_MAX_CONCURRENT_REQUESTS=4","handlingStrategy":"validation","validationCode":"import os\nraw = os.getenv('MINERU_API_MAX_CONCURRENT_REQUESTS')\nif raw is not None:\n    try:\n        n = int(raw)\n        assert n > 0\n    except (ValueError, AssertionError):\n        raise SystemExit(f'MINERU_API_MAX_CONCURRENT_REQUESTS={raw!r} must be a positive integer')","typeGuard":"def valid_concurrency_env(raw: str | None) -> bool:\n    if raw is None:\n        return True\n    try:\n        return int(raw) > 0\n    except ValueError:\n        return False","tryCatchPattern":"try:\n    limit = get_max_concurrent_requests(default=3)\nexcept ValueError as e:\n    raise SystemExit(f'Bad concurrency config: {e}') from e  # fail fast at boot, not per request","preventionTips":["Validate all MINERU_* integer env vars in a single boot-time preflight.","Prefer unsetting the variable over setting an empty string when defaults are wanted.","In compose/Kubernetes manifests quote env values and lint them as integers in CI."],"tags":["environment-variable","config","api-client","mineru"],"backgroundTag":null,"analyzedSha":"4fe4bde114a23ee5dd637eae99b767f4669bf58c","analyzedAt":"2026-08-14T21:29:18.456Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}