{"record":{"id":"52ed11662745b06f","repo":"agentscope-ai/agentscope","slug":"str-e","errorCode":null,"errorMessage":"{str(e)}","messagePattern":"\\{str\\(e\\)\\}","errorType":"http","errorClass":"HTTPException","httpStatus":null,"severity":"error","filePath":"src/agentscope/app/_router/_channel.py","lineNumber":148,"sourceCode":"    body: CreateChannelRequest,\n    service: ChannelService = Depends(get_channel_service),\n    registry: ChannelTypeRegistry = Depends(get_channel_type_registry),\n    user_id: str = Depends(get_current_user_id),\n) -> ChannelResponse:\n    \"\"\"Create a channel.\"\"\"\n    try:\n        record = await service.create(\n            user_id=user_id,\n            channel_type=body.channel_type,\n            name=body.name,\n            credentials=body.credentials,\n            platform_config=body.platform_config,\n            routing=body.routing,\n            session=body.session,\n            enabled=body.enabled,\n        )\n    except ChannelError as e:\n        raise HTTPException(e.status_code, str(e)) from e\n    except ValueError as e:\n        raise HTTPException(status.HTTP_400_BAD_REQUEST, str(e)) from e\n    return _to_response(record, registry)\n\n\n@channel_router.get(\"/{channel_id}\")\nasync def get_channel(\n    channel_id: str,\n    storage: StorageBase = Depends(get_storage),\n    registry: ChannelTypeRegistry = Depends(get_channel_type_registry),\n    user_id: str = Depends(get_current_user_id),\n) -> ChannelResponse:\n    \"\"\"Get channel details.\"\"\"\n    record = await _owned(channel_id, user_id, storage)\n    return _to_response(record, registry)\n\n\n@channel_router.patch(\"/{channel_id}\")","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/agentscope-ai/agentscope/blob/e90f1c7592896cc95f6e5ee506194f533378247d/src/agentscope/app/_router/_channel.py#L130-L166","documentation":"create_channel maps ChannelError from the channel service to an HTTP error using the status code carried by the exception, with the exception message as detail. Typical causes: unsupported platform/type, invalid platform_config, or service-level channel setup failures.","triggerScenarios":"POSTing a channel with a platform/type the registry does not support, malformed platform_config, or a channel type whose connector fails initialization.","commonSituations":"Typos in channel type names; missing credentials in platform_config (e.g. no API token); using a channel type whose plugin/connector is not registered in the running app.","solutions":["Read the response detail — it is the underlying ChannelError message","List available channel types (GET /channels/types) and use a supported one","Complete platform_config with required credentials/fields for that type","Register the channel type plugin with the app if it should be available"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"types_resp = requests.get(f\"{base}/channels/types\")\nsupported = {t[\"type\"] for t in types_resp.json()}\nif body[\"type\"] not in supported:\n    raise ValueError(f\"unsupported channel type {body['type']}\")","typeGuard":null,"tryCatchPattern":"resp = requests.post(f\"{base}/channels\", json=body)\nif resp.status_code >= 400:\n    raise RuntimeError(f\"channel create failed: {resp.json()['detail']}\")","preventionTips":["Check GET /channels/types before creating channels","Include all required credentials in platform_config","Register custom channel-type plugins at app startup"],"tags":["agentscope","http","channel","creation","channel-error"],"backgroundTag":"invalid-channel-configuration","analyzedSha":"e90f1c7592896cc95f6e5ee506194f533378247d","analyzedAt":"2026-08-28T18:24:12.087Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}