{"record":{"id":"ee84315690585550","repo":"hyperledger/fabric","slug":"errchannelalreadyexists","errorCode":"ErrChannelAlreadyExists","errorMessage":"channel already exists","messagePattern":"channel already exists","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"orderer/common/types/errors.go","lineNumber":21,"sourceCode":"\nSPDX-License-Identifier: Apache-2.0\n*/\n\npackage types\n\nimport \"github.com/pkg/errors\"\n\n// ErrSystemChannelExists is returned when trying to join or remove an application channel when the system channel exists.\n//\n// Deprecated: system channel no longer supported\nvar ErrSystemChannelExists = errors.New(\"system channel exists\")\n\n// ErrSystemChannelNotSupported is returned when trying to join with a system channel config block.\nvar ErrSystemChannelNotSupported = errors.New(\"system channel not supported\")\n\n// ErrChannelAlreadyExists is returned when trying to join a app channel that already exists (when the system channel does not\n// exist), or when trying to join the system channel when it already exists.\nvar ErrChannelAlreadyExists = errors.New(\"channel already exists\")\n\n// ErrAppChannelsAlreadyExists is returned when trying to join a system channel (that does not exist) when application channels\n// already exist.\nvar ErrAppChannelsAlreadyExists = errors.New(\"application channels already exist\")\n\n// ErrChannelNotExist is returned when trying to remove or list a channel that does not exist\nvar ErrChannelNotExist = errors.New(\"channel does not exist\")\n\n// ErrChannelPendingRemoval is returned when trying to remove or list a channel that is being removed.\nvar ErrChannelPendingRemoval = errors.New(\"channel pending removal\")\n\n// ErrChannelRemovalFailure is returned when a removal attempt failure has been recorded.\nvar ErrChannelRemovalFailure = errors.New(\"channel removal failure\")\n\n// ErrChannelNotReady is returned when trying to update a channel that is a follower\nvar ErrChannelNotReady = errors.New(\"channel is not ready, he is a follower\")\n","sourceCodeStart":3,"sourceCodeEnd":38,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/orderer/common/types/errors.go#L3-L38","documentation":"ErrChannelAlreadyExists is returned when attempting to join a channel whose name already exists on the orderer — either an app channel that was already joined (no system channel) or the system channel itself when it already exists. The REST handler maps it to 405 Method Not Allowed with GET/DELETE allowed.","triggerScenarios":"POST /participation/v1/channels for a channelID already joined by that orderer; JoinChannel in the channel-participation manager detects an existing ledger/channel with the same ID.","commonSituations":"Re-running 'osnadmin channel join' after a successful first join; scripted re-provisioning that does not check existing channels; joining on multiple orderers where one already has the channel.","solutions":["Check existing channels with 'osnadmin channel list' before joining","Skip the join if the channel already exists (treat as success in scripts)","If a stale/broken channel must be recreated, remove it first with 'osnadmin channel remove' (after app channels are drained), then join","Use a distinct channelID if a genuinely new channel was intended"],"exampleFix":"// before\nosnadmin channel join --channelID mychannel --config-block app.block  # 405: channel already exists\n// after\nCHANNELS=$(osnadmin channel list --serverAddress ... | jq -r '.channels[].name')\nif [[ \"$CHANNELS\" != *mychannel* ]]; then\n  osnadmin channel join --channelID mychannel --config-block app.block\nfi","handlingStrategy":"try-catch","validationCode":"info, err := client.ListChannels()\nexists := slices.Contains(info.Channels, targetChannelID)","typeGuard":null,"tryCatchPattern":"if errors.Is(err, types.ErrChannelAlreadyExists) {\n    // treat as success: channel is already joined\n}","preventionTips":["Run 'osnadmin channel list' before joining","Make join scripts idempotent (skip when already joined)","Use unique channelIDs for new channels"],"tags":["fabric","orderer","channel-participation","duplicate-resource","http-405"],"backgroundTag":"resource-already-exists","analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}