{"record":{"id":"5c1dc7a901bc769f","repo":"hyperledger/fabric","slug":"invalid-chaincode-id","errorCode":null,"errorMessage":"invalid chaincode ID","messagePattern":"invalid chaincode ID","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/committer/txvalidator/v14/vscc_validator.go","lineNumber":101,"sourceCode":"\t\treturn peer.TxValidationCode_BAD_RWSET, errors.WithMessage(err, \"txRWSet.FromProtoBytes failed\")\n\t}\n\n\t// Verify the header extension and response payload contain the ChaincodeId\n\tif hdrExt.ChaincodeId == nil {\n\t\treturn peer.TxValidationCode_INVALID_OTHER_REASON, errors.New(\"nil ChaincodeId in header extension\")\n\t}\n\n\tif respPayload.ChaincodeId == nil {\n\t\treturn peer.TxValidationCode_INVALID_OTHER_REASON, errors.New(\"nil ChaincodeId in ChaincodeAction\")\n\t}\n\n\t// get name and version of the cc we invoked\n\tccID := hdrExt.ChaincodeId.Name\n\tccVer := respPayload.ChaincodeId.Version\n\n\t// sanity check on ccID\n\tif ccID == \"\" {\n\t\terr = errors.New(\"invalid chaincode ID\")\n\t\tlogger.Errorf(\"%+v\", err)\n\t\treturn peer.TxValidationCode_INVALID_OTHER_REASON, err\n\t}\n\tif ccID != respPayload.ChaincodeId.Name {\n\t\terr = errors.Errorf(\"inconsistent ccid info (%s/%s)\", ccID, respPayload.ChaincodeId.Name)\n\t\tlogger.Errorf(\"%+v\", err)\n\t\treturn peer.TxValidationCode_INVALID_OTHER_REASON, err\n\t}\n\t// sanity check on ccver\n\tif ccVer == \"\" {\n\t\terr = errors.New(\"invalid chaincode version\")\n\t\tlogger.Errorf(\"%+v\", err)\n\t\treturn peer.TxValidationCode_INVALID_OTHER_REASON, err\n\t}\n\n\tvar wrNamespace []string\n\talwaysEnforceOriginalNamespace := v.cr.Capabilities().V1_2Validation()\n\tif alwaysEnforceOriginalNamespace {","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/committer/txvalidator/v14/vscc_validator.go#L83-L119","documentation":"The chaincode name taken from the header extension (hdrExt.ChaincodeId.Name) is an empty string. VSCC treats an empty ID as a sanity-check failure, logs it, and invalidates the transaction with TxValidationCode_INVALID_OTHER_REASON.","triggerScenarios":"ChaincodeHeaderExtension was marshalled with a ChaincodeID whose Name field is empty (or absent), e.g. a client passed an empty chaincode name to the SDK's invoke/send-transaction call.","commonSituations":"Misconfigured client where the chaincode name is read from an unset environment variable or config key (empty string); typos producing a blank name; generic tooling invoking transactions without resolving the target chaincode.","solutions":["Fix the client configuration so the chaincode name is a non-empty value at invoke time.","Add client-side validation that rejects invoke requests with empty chaincodeName before submitting.","Resubmit the transaction with the correct chaincode name."],"exampleFix":"// before\nccName := os.Getenv(\"CHAINCODE_NAME\") // may be \"\"\n// after\nccName := os.Getenv(\"CHAINCODE_NAME\")\nif ccName == \"\" { return errors.New(\"chaincode name required\") }","handlingStrategy":"validation","validationCode":"if chaincodeName == \"\" {\n    return fmt.Errorf(\"chaincode name must be non-empty before invoking transaction on channel %s\", channelID)\n}","typeGuard":"func validChaincodeName(name string) bool {\n\treturn strings.TrimSpace(name) != \"\"\n}","tryCatchPattern":"if ccID == \"\" {\n    logger.Warnf(\"tx rejected: invalid chaincode ID\")\n    return peer.TxValidationCode_INVALID_OTHER_REASON, nil\n}","preventionTips":["Fail fast in client config loading when chaincode name is empty.","Use explicit config with required-field checks rather than raw env reads.","Add integration tests that assert a name is present in every invoke request."],"tags":["fabric","transaction-validation","sanity-check"],"backgroundTag":"invalid-chaincode-id","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"}