langflow-ai/langflow · error · ValueError

connections contains duplicate app_id values: {duplicates}

Error message

connections contains duplicate app_id values: {duplicates}

What it means

API payload validator: app_id values across provider_data.connections must be unique. A Counter over the connections detects any app_id used more than once and raises ValueError 'connections contains duplicate app_id values' (422). Each connection is identified solely by app_id, so duplicates would make operation references ambiguous.

Source

Thrown at src/backend/base/langflow/api/v1/mappers/deployments/watsonx_orchestrate/payloads.py:264

    conflicts = sorted(normalized_remove_ids.intersection(normalized_upsert_ids))
    if conflicts:
        msg = f"{remove_label} cannot be combined with upsert for the same id: {conflicts}"
        raise ValueError(msg)


def _validate_api_unused_raw_app_ids(*, raw_app_ids: set[str], referenced_app_ids: set[str]) -> None:
    unused_raw_app_ids = sorted(raw_app_ids.difference(referenced_app_ids))
    if unused_raw_app_ids:
        msg = f"connections contains app_id values not referenced by operations: {unused_raw_app_ids}"
        raise ValueError(msg)


def _validate_api_unique_connection_app_ids(*, connections: list[WatsonxApiKeyValueConnectionPayload]) -> None:
    app_id_counts = Counter(connection.app_id for connection in connections)
    duplicates = sorted(app_id for app_id, count in app_id_counts.items() if count > 1)
    if duplicates:
        msg = f"connections contains duplicate app_id values: {duplicates}"
        raise ValueError(msg)


class WatsonxApiDeploymentUpdatePayload(BaseModel):
    """Watsonx provider_data API contract for deployment update operations.

    All operation fields default to empty lists so LLM-only updates
    (changing the model without any tool/connection changes) can be
    expressed without providing operation entries.
    """

    model_config = {"extra": "forbid"}

    display_name: NormalizedStr | None = Field(
        default=None,
        description="Optional user-facing label to set on the wxO agent.",
    )
    llm: NormalizedStr | None = Field(
        default=None,

View on GitHub (pinned to 976ec789d2)

Solutions

  1. Keep one entry per app_id; if you need different credentials, use a different app_id.
  2. Deduplicate client-side by app_id before sending (last one wins or merge credentials).
  3. Check that UI multi-selects cannot add the same connection twice.

Example fix

// before
{"connections": [{"app_id": "c1", "credentials": [...]}, {"app_id": "c1", "credentials": [...]}]}
// after
{"connections": [{"app_id": "c1", "credentials": [...]}]}
Defensive patterns

Strategy: validation

Validate before calling

app_ids = [c["app_id"] for c in provider_data.get("connections", [])]
assert len(app_ids) == len(set(app_ids)), f"duplicate connection app_ids: {[a for a in app_ids if app_ids.count(a) > 1]}"

Type guard

def has_unique_connection_app_ids(connections: list[dict]) -> bool:
    ids = [c["app_id"] for c in connections]
    return len(ids) == len(set(ids))

Prevention

When it happens

Trigger: POST/PATCH a wxO deployment with two or more connections[] entries sharing the same app_id (e.g. same connection repeated with different credentials).

Common situations: Copy-paste editing of connections arrays; merging payloads from two sources that both include the same connection; UI list not deduplicating selected connections.

Related errors


AI-assisted analysis of langflow-ai/langflow@976ec789d2 (2026-08-14). Data as JSON: /api/errors/c06a38b0090f2303. Report an issue: GitHub.