{"record":{"id":"dbdaf89b699941f3","repo":"hyperledger/fabric","slug":"bad-type","errorCode":null,"errorMessage":"bad type","messagePattern":"bad type","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"orderer/common/channelparticipation/validator.go","lineNumber":89,"sourceCode":"// It verifies it is an application channel by checking that the application group exists.\n// It returns an error when it cannot be used as a update config envelope.\nfunc ValidateUpdateConfigEnvelope(env *cb.Envelope) (channelID string, err error) {\n\tpayload, err := protoutil.UnmarshalPayload(env.Payload)\n\tif err != nil {\n\t\treturn \"\", errors.New(\"bad payload\")\n\t}\n\n\tif payload.Header == nil || payload.Header.ChannelHeader == nil {\n\t\treturn \"\", errors.New(\"bad header\")\n\t}\n\n\tch, err := protoutil.UnmarshalChannelHeader(payload.Header.ChannelHeader)\n\tif err != nil {\n\t\treturn \"\", errors.New(\"could not unmarshall channel header\")\n\t}\n\n\tif ch.Type != int32(cb.HeaderType_CONFIG_UPDATE) {\n\t\treturn \"\", errors.New(\"bad type\")\n\t}\n\n\tif ch.ChannelId == \"\" {\n\t\treturn \"\", errors.New(\"empty channel id\")\n\t}\n\n\tconfigUpdateEnv, err := protoutil.EnvelopeToConfigUpdate(env)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tconfigUpdate, err := configtx.UnmarshalConfigUpdate(configUpdateEnv.ConfigUpdate)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn configUpdate.ChannelId, nil\n}","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/orderer/common/channelparticipation/validator.go#L71-L107","documentation":"ValidateUpdateConfigEnvelope only accepts envelopes whose ChannelHeader type is HeaderType_CONFIG_UPDATE. This error means the envelope is valid protobuf but of the wrong message type (e.g. ENDORSER_TRANSACTION, MESSAGE, CONFIG).","triggerScenarios":"Submitting a regular transaction envelope, a CONFIG envelope, or any non-CONFIG_UPDATE envelope to the channel participation join/update API.","commonSituations":"Confusing a config-update envelope with a full CONFIG envelope; accidentally uploading a computed config block instead of a ConfigUpdateEnvelope; script reusing a transaction envelope from a ledger fetch.","solutions":["Extract the ConfigUpdateEnvelope from the config block: read the block's CONFIG envelope and take its ConfigUpdate field, then wrap it as HeaderType_CONFIG_UPDATE.","Use configtxlator (proto_decode / proto_encode between common.Config and ConfigUpdate) to build the correct envelope type.","Check ch.Type before submitting: it must equal int32(cb.HeaderType_CONFIG_UPDATE) (value 2).","Use the standard 'peer channel fetch config' + configtxlator + 'peer channel update' pipeline rather than raw block uploads."],"exampleFix":"// before\nenv = configBlockEnv // header type CONFIG, not CONFIG_UPDATE\n// after\ncuEnv, _ := protoutil.CreateSignedEnvelope(cb.HeaderType_CONFIG_UPDATE, \"mychannel\", signer, configUpdate, 0, 0)","handlingStrategy":"validation","validationCode":"hdr, _ := protoutil.UnmarshalChannelHeader(payload.Header.ChannelHeader)\nif hdr.Type != int32(cb.HeaderType_CONFIG_UPDATE) {\n    return fmt.Errorf(\"expected CONFIG_UPDATE envelope, got type %d\", hdr.Type)\n}","typeGuard":"func isConfigUpdateEnvelope(env *cb.Envelope) bool {\n    p, err := protoutil.UnmarshalPayload(env.Payload)\n    if err != nil || p.Header == nil || p.Header.ChannelHeader == nil { return false }\n    ch, err := protoutil.UnmarshalChannelHeader(p.Header.ChannelHeader)\n    return err == nil && ch.Type == int32(cb.HeaderType_CONFIG_UPDATE)\n}","tryCatchPattern":"if _, err := ValidateUpdateConfigEnvelope(env); err != nil && strings.Contains(err.Error(), \"bad type\") {\n    // rebuild via protoutil.CreateSignedEnvelope(cb.HeaderType_CONFIG_UPDATE, ...)\n}","preventionTips":["Distinguish CONFIG vs CONFIG_UPDATE envelope types; never upload raw config blocks as updates","Use the configtxlator-based update pipeline (fetch config -> compute delta -> sign -> update)","Check the header type in tooling before any participation API call"],"tags":["fabric","orderer","wrong-type","config-update"],"backgroundTag":"wrong-envelope-type","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"}