{"record":{"id":"c06a38b0090f2303","repo":"langflow-ai/langflow","slug":"connections-contains-duplicate-app-id-values-dup","errorCode":null,"errorMessage":"connections contains duplicate app_id values: {duplicates}","messagePattern":"connections contains duplicate app_id values: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":422,"severity":"error","filePath":"src/backend/base/langflow/api/v1/mappers/deployments/watsonx_orchestrate/payloads.py","lineNumber":264,"sourceCode":"    conflicts = sorted(normalized_remove_ids.intersection(normalized_upsert_ids))\n    if conflicts:\n        msg = f\"{remove_label} cannot be combined with upsert for the same id: {conflicts}\"\n        raise ValueError(msg)\n\n\ndef _validate_api_unused_raw_app_ids(*, raw_app_ids: set[str], referenced_app_ids: set[str]) -> None:\n    unused_raw_app_ids = sorted(raw_app_ids.difference(referenced_app_ids))\n    if unused_raw_app_ids:\n        msg = f\"connections contains app_id values not referenced by operations: {unused_raw_app_ids}\"\n        raise ValueError(msg)\n\n\ndef _validate_api_unique_connection_app_ids(*, connections: list[WatsonxApiKeyValueConnectionPayload]) -> None:\n    app_id_counts = Counter(connection.app_id for connection in connections)\n    duplicates = sorted(app_id for app_id, count in app_id_counts.items() if count > 1)\n    if duplicates:\n        msg = f\"connections contains duplicate app_id values: {duplicates}\"\n        raise ValueError(msg)\n\n\nclass WatsonxApiDeploymentUpdatePayload(BaseModel):\n    \"\"\"Watsonx provider_data API contract for deployment update operations.\n\n    All operation fields default to empty lists so LLM-only updates\n    (changing the model without any tool/connection changes) can be\n    expressed without providing operation entries.\n    \"\"\"\n\n    model_config = {\"extra\": \"forbid\"}\n\n    display_name: NormalizedStr | None = Field(\n        default=None,\n        description=\"Optional user-facing label to set on the wxO agent.\",\n    )\n    llm: NormalizedStr | None = Field(\n        default=None,","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/api/v1/mappers/deployments/watsonx_orchestrate/payloads.py#L246-L282","documentation":"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.","triggerScenarios":"POST/PATCH a wxO deployment with two or more connections[] entries sharing the same app_id (e.g. same connection repeated with different credentials).","commonSituations":"Copy-paste editing of connections arrays; merging payloads from two sources that both include the same connection; UI list not deduplicating selected connections.","solutions":["Keep one entry per app_id; if you need different credentials, use a different app_id.","Deduplicate client-side by app_id before sending (last one wins or merge credentials).","Check that UI multi-selects cannot add the same connection twice."],"exampleFix":"// before\n{\"connections\": [{\"app_id\": \"c1\", \"credentials\": [...]}, {\"app_id\": \"c1\", \"credentials\": [...]}]}\n// after\n{\"connections\": [{\"app_id\": \"c1\", \"credentials\": [...]}]}","handlingStrategy":"validation","validationCode":"app_ids = [c[\"app_id\"] for c in provider_data.get(\"connections\", [])]\nassert len(app_ids) == len(set(app_ids)), f\"duplicate connection app_ids: {[a for a in app_ids if app_ids.count(a) > 1]}\"","typeGuard":"def has_unique_connection_app_ids(connections: list[dict]) -> bool:\n    ids = [c[\"app_id\"] for c in connections]\n    return len(ids) == len(set(ids))","tryCatchPattern":null,"preventionTips":["Key connections by app_id in a client-side map so duplicates are impossible.","Deduplicate by app_id before submit (decide a merge policy for credentials).","Prevent double-adding the same connection in selection UIs."],"tags":["watsonx-orchestrate","pydantic","validation","http-422","connections","duplicates"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}