{"record":{"id":"afb9701a6051878b","repo":"deepset-ai/haystack","slug":"concurrency-limit-must-be-greater-than-or-equal-to","errorCode":null,"errorMessage":"concurrency_limit must be greater than or equal to 1.","messagePattern":"concurrency_limit must be greater than or equal to 1\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"haystack/core/pipeline/pipeline.py","lineNumber":889,"sourceCode":"        :param concurrency_limit: The maximum number of components that are allowed to run concurrently.\n        :param include_outputs_from:\n            Set of component names whose individual outputs are to be\n            included in the pipeline's output. For components that are\n            invoked multiple times (in a loop), only the last-produced\n            output is included.\n        :return: An async iterator containing partial (and final) outputs.\n\n        :raises ValueError:\n            If invalid inputs are provided to the pipeline, or if `concurrency_limit` is less than 1.\n        :raises PipelineMaxComponentRuns:\n            If a component exceeds the maximum number of allowed executions within the pipeline.\n        :raises PipelineRuntimeError:\n            If the Pipeline contains cycles with unsupported connections that would cause\n            it to get stuck and fail running.\n            Or if a Component fails or returns output in an unsupported type.\n        \"\"\"\n        if concurrency_limit < 1:\n            raise ValueError(\"concurrency_limit must be greater than or equal to 1.\")\n\n        pipeline_running(self)  # telemetry\n\n        # warm up the pipeline by running each component's warm_up_async (or warm_up) method\n        await self.warm_up_async()\n\n        if include_outputs_from is None:\n            include_outputs_from = set()\n\n        pipeline_outputs: dict[str, Any] = {}\n\n        # Normalize `data` and raise ValueError if the input is malformed in some way.\n        data = self._prepare_component_input_data(data)\n\n        # Raise ValueError if input is malformed in some way\n        self.validate_input(data)\n\n        # We create a list of components in the pipeline sorted by name, so that the algorithm runs","sourceCodeStart":871,"sourceCodeEnd":907,"githubUrl":"https://github.com/deepset-ai/haystack/blob/e318778c9bf60a1963e3b5f451359655dd696c30/haystack/core/pipeline/pipeline.py#L871-L907","documentation":"run_async_generator (pipeline.py:889) validates its concurrency_limit argument before running the pipeline. A value below 1 would deadlock or misbehave in the asyncio task scheduling, so a plain ValueError is raised. run_async forwards its concurrency_limit here, so both entry points can trigger it.","triggerScenarios":"pipe.run_async(data, concurrency_limit=0) or concurrency_limit=-1, often from a config value or computed value like max(len(workers), 0) when a list is empty.","commonSituations":"Config file where concurrency is set to 0 to mean 'unlimited' (it does not); dynamic sizing from an empty collection; typos in defaults.","solutions":["Pass concurrency_limit >= 1 (e.g. 1 for sequential execution).","If the value comes from config, clamp it: max(1, configured_value).","If 'unlimited' was intended, omit the argument and use the default instead of 0."],"exampleFix":"# before\nawait pipe.run_async(data, concurrency_limit=0)\n# after\nawait pipe.run_async(data, concurrency_limit=max(1, configured_limit))\n","handlingStrategy":"validation","validationCode":"if concurrency_limit is not None and concurrency_limit < 1:\n    raise ValueError('concurrency_limit must be >= 1')","typeGuard":null,"tryCatchPattern":"try:\n    agen = pipe.run_async(data, concurrency_limit=cfg_limit)\nexcept ValueError as e:\n    if 'concurrency_limit' in str(e):\n        agen = pipe.run_async(data, concurrency_limit=max(1, cfg_limit))","preventionTips":["Clamp config-sourced concurrency values with max(1, value).","Never encode 'unlimited' as 0; omit the parameter instead.","Guard against empty-list-derived limits: len(x) or 1."],"tags":["pipeline","asyncio","validation","argument-error"],"backgroundTag":"invalid-argument-value","analyzedSha":"e318778c9bf60a1963e3b5f451359655dd696c30","analyzedAt":"2026-08-30T11:45:20.711Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}