{"record":{"id":"4d917bcaed98c6ee","repo":"langflow-ai/langflow","slug":"label-must-not-reference-connections-app-ids-i","errorCode":null,"errorMessage":"{label} must not reference connections app_ids: {invalid_raw}","messagePattern":"(.+?) must not reference connections app_ids: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":422,"severity":"error","filePath":"src/backend/base/langflow/api/v1/mappers/deployments/watsonx_orchestrate/payloads.py","lineNumber":220,"sourceCode":"def _collect_api_referenced_app_ids(operations: list[Any], *, attr_name: str = \"app_ids\") -> set[str]:\n    referenced_app_ids: set[str] = set()\n    for operation in operations:\n        operation_app_ids = getattr(operation, attr_name, None)\n        if not operation_app_ids:\n            continue\n        referenced_app_ids.update(operation_app_ids)\n    return referenced_app_ids\n\n\ndef _validate_api_remove_not_raw(*, operations: list[Any], raw_app_ids: set[str], attr_name: str, label: str) -> None:\n    for operation in operations:\n        remove_app_ids = getattr(operation, attr_name, None)\n        if not remove_app_ids:\n            continue\n        invalid_raw = sorted(raw_app_ids.intersection(set(remove_app_ids)))\n        if invalid_raw:\n            msg = f\"{label} must not reference connections app_ids: {invalid_raw}\"\n            raise ValueError(msg)\n\n\ndef _validate_api_add_remove_overlap(*, operations: list[Any], label: str) -> None:\n    for operation in operations:\n        add_app_ids = set(getattr(operation, \"add_app_ids\", []) or [])\n        remove_app_ids = set(getattr(operation, \"remove_app_ids\", []) or [])\n        overlap = sorted(add_app_ids.intersection(remove_app_ids))\n        if overlap:\n            msg = f\"{label} add_app_ids and remove_app_ids must not overlap: {overlap}\"\n            raise ValueError(msg)\n\n\ndef _validate_api_remove_conflicts(\n    *,\n    remove_ids: list[Any],\n    upsert_operations: list[Any],\n    remove_label: str,\n    upsert_attr_name: str,","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/api/v1/mappers/deployments/watsonx_orchestrate/payloads.py#L202-L238","documentation":"API payload validator for wxO deployment updates: remove_app_ids on upsert_flows/upsert_tools items reference provider tool app bindings, not raw connection app_ids declared in provider_data.connections. If a remove_app_ids value intersects the connections' app_id set, ValueError '{label} must not reference connections app_ids' is raised (surfaces as 422). Removing a connection is expressed via the connections list itself, not via tool operations.","triggerScenarios":"PATCH a wxO deployment where upsert_flows[i].remove_app_ids or upsert_tools[i].remove_app_ids contains an app_id that also appears in provider_data.connections[].app_id.","commonSituations":"Developers assuming remove_app_ids can detach a credential connection; UI 'remove' action mistakenly feeding connection ids into tool operations; reusing one id namespace for both connections and tool bindings.","solutions":["Remove the connection by dropping its entry from provider_data.connections instead of listing its app_id in remove_app_ids.","Keep remove_app_ids limited to provider tool-binding app ids previously added via add_app_ids.","Audit client code so connection ids and tool-binding app ids never share values."],"exampleFix":"// before\n{\"connections\": [{\"app_id\": \"conn1\", ...}], \"upsert_tools\": [{\"tool_id\": \"t1\", \"remove_app_ids\": [\"conn1\"]}]}\n// after\n{\"connections\": [], \"upsert_tools\": [{\"tool_id\": \"t1\", \"remove_app_ids\": [\"<tool-binding-app-id>\"]}]}","handlingStrategy":"validation","validationCode":"raw_conn_ids = {c[\"app_id\"] for c in provider_data.get(\"connections\", [])}\nfor item in provider_data.get(\"upsert_flows\", []) + provider_data.get(\"upsert_tools\", []):\n    bad = set(item.get(\"remove_app_ids\", [])) & raw_conn_ids\n    assert not bad, f\"remove_app_ids must not reference connections app_ids: {bad}\"","typeGuard":"def removes_reference_connections(item: dict, conn_ids: set[str]) -> bool:\n    return bool(set(item.get(\"remove_app_ids\", [])) & conn_ids)","tryCatchPattern":null,"preventionTips":["Model two id namespaces client-side: connection app_ids vs tool-binding app ids — never mix them.","To remove a connection, delete its entry from connections.","Keep remove_app_ids populated only from previously-added binding ids."],"tags":["watsonx-orchestrate","pydantic","validation","http-422","connections","app-ids"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}