zylon-ai/private-gpt · error · ValueError

Invalid system item in list: {item}

Error message

Invalid system item in list: {item}

What it means

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.

Source

Thrown at private_gpt/chat/input_models.py:212

    if isinstance(system, list):
        # Convert each item to System
        converted: list[System] = []
        for item in system:
            if isinstance(item, System):
                converted.append(item)
            elif isinstance(item, TextBlock):
                converted.append(System(text=item.text))
            elif isinstance(item, str):
                converted.append(System(text=item))
            elif isinstance(item, dict):
                try:
                    converted.append(System.model_validate(item))
                except Exception as e:
                    raise ValueError(
                        f"Invalid system item in list (dict): {item}"
                    ) from e
            else:
                raise ValueError(f"Invalid system item in list: {item}")

        if not converted:
            return System()

        # Merge converted System objects into a single System
        potential_system = converted[0]
        for item in converted[1:]:
            merged_text = None
            if potential_system.text or item.text:
                # concatenate texts with newline when both present
                if potential_system.text and item.text:
                    merged_text = f"{potential_system.text}\n{item.text}"
                else:
                    merged_text = potential_system.text or item.text

            potential_system = System(
                text=merged_text,
                use_default_prompt=item.use_default_prompt

View on GitHub (pinned to 4a030776a3)

Solutions

  1. Enable and configure the Celery-based scheduler (broker + result backend URLs, workers running) so ingest_async is implemented.
  2. Or switch the client to the synchronous ingestion endpoint for single-process deployments.
  3. Verify settings: the ingestion scheduler mode in settings.yaml/.env and that a worker is reachable.

Example fix

# before
POST /ingest/async   # 501 under local scheduler

# after (option A: use sync endpoint)
POST /ingest

# after (option B: enable celery in settings.yaml)
ingestion:
  scheduler: celery   # plus CELERY_BROKER_URL / CELERY_RESULT_BACKEND
Defensive patterns

Strategy: fallback

Validate before calling

// Probe async support once at startup
let asyncSupported = true;
try { await api.ingestAsync(smallProbe); }
catch (e) { asyncSupported = e.status !== 501; }

Try / catch

try { return await api.ingestAsync(body); }
catch (e) {
  if (e.status === 501) return api.ingestSync(body); // fallback to sync
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of zylon-ai/private-gpt@4a030776a3 (2026-08-15). Data as JSON: /api/errors/4b715ff01bec2f0f. Report an issue: GitHub.