{"record":{"id":"4b715ff01bec2f0f","repo":"zylon-ai/private-gpt","slug":"invalid-system-item-in-list-item","errorCode":null,"errorMessage":"Invalid system item in list: {item}","messagePattern":"Invalid system item in list: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"private_gpt/chat/input_models.py","lineNumber":212,"sourceCode":"    if isinstance(system, list):\n        # Convert each item to System\n        converted: list[System] = []\n        for item in system:\n            if isinstance(item, System):\n                converted.append(item)\n            elif isinstance(item, TextBlock):\n                converted.append(System(text=item.text))\n            elif isinstance(item, str):\n                converted.append(System(text=item))\n            elif isinstance(item, dict):\n                try:\n                    converted.append(System.model_validate(item))\n                except Exception as e:\n                    raise ValueError(\n                        f\"Invalid system item in list (dict): {item}\"\n                    ) from e\n            else:\n                raise ValueError(f\"Invalid system item in list: {item}\")\n\n        if not converted:\n            return System()\n\n        # Merge converted System objects into a single System\n        potential_system = converted[0]\n        for item in converted[1:]:\n            merged_text = None\n            if potential_system.text or item.text:\n                # concatenate texts with newline when both present\n                if potential_system.text and item.text:\n                    merged_text = f\"{potential_system.text}\\n{item.text}\"\n                else:\n                    merged_text = potential_system.text or item.text\n\n            potential_system = System(\n                text=merged_text,\n                use_default_prompt=item.use_default_prompt","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/chat/input_models.py#L194-L230","documentation":"Raised by the async ingestion endpoint when the configured IngestionSchedulerFactory scheduler raises NotImplementedError from ingest_async(). This happens when the active scheduler has no async backend — i.e. Celery (or equivalent) is not configured/enabled — so the endpoint reports 501 Not Implemented.","triggerScenarios":"POST /ingest/async with a scheduler selected (e.g. the default local/immediate one) that does not implement asynchronous dispatch; Celery unavailable in the process (import guard _CELERY_AVAILABLE false) or broker/worker settings absent.","commonSituations":"Running the single-process/Local server profile but a client (often generated from OpenAPI) calls the async route; CELERY disabled in settings.yaml or broker URL unset after deployment; upgrading to a config where async support must be explicitly enabled.","solutions":["Enable and configure the Celery-based scheduler (broker + result backend URLs, workers running) so ingest_async is implemented.","Or switch the client to the synchronous ingestion endpoint for single-process deployments.","Verify settings: the ingestion scheduler mode in settings.yaml/.env and that a worker is reachable."],"exampleFix":"# before\nPOST /ingest/async   # 501 under local scheduler\n\n# after (option A: use sync endpoint)\nPOST /ingest\n\n# after (option B: enable celery in settings.yaml)\ningestion:\n  scheduler: celery   # plus CELERY_BROKER_URL / CELERY_RESULT_BACKEND","handlingStrategy":"fallback","validationCode":"// Probe async support once at startup\nlet asyncSupported = true;\ntry { await api.ingestAsync(smallProbe); }\ncatch (e) { asyncSupported = e.status !== 501; }","typeGuard":null,"tryCatchPattern":"try { return await api.ingestAsync(body); }\ncatch (e) {\n  if (e.status === 501) return api.ingestSync(body); // fallback to sync\n  throw e;\n}","preventionTips":["Advertise scheduler capability in your deployment config and pick endpoints accordingly","Health-check the Celery broker/worker before mounting async clients","Keep a sync fallback path in ingestion pipelines"],"tags":["fastapi","http-501","celery","ingestion","configuration"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}