{"record":{"id":"fe7177c4ddd538a6","repo":"hyperledger/fabric","slug":"chaincode-language-must-be-specified","errorCode":null,"errorMessage":"chaincode language must be specified","messagePattern":"chaincode language must be specified","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/peer/lifecycle/chaincode/package.go","lineNumber":54,"sourceCode":"\tWriter           Writer\n}\n\n// PackageInput holds the input parameters for packaging a\n// ChaincodeInstallPackage\ntype PackageInput struct {\n\tOutputFile string\n\tPath       string\n\tType       string\n\tLabel      string\n}\n\n// Validate checks for the required inputs\nfunc (p *PackageInput) Validate() error {\n\tif p.Path == \"\" {\n\t\treturn errors.New(\"chaincode path must be specified\")\n\t}\n\tif p.Type == \"\" {\n\t\treturn errors.New(\"chaincode language must be specified\")\n\t}\n\tif p.OutputFile == \"\" {\n\t\treturn errors.New(\"output file must be specified\")\n\t}\n\tif p.Label == \"\" {\n\t\treturn errors.New(\"package label must be specified\")\n\t}\n\tif err := persistence.ValidateLabel(p.Label); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\n// PackageCmd returns the cobra command for packaging chaincode\nfunc PackageCmd(p *Packager) *cobra.Command {\n\tchaincodePackageCmd := &cobra.Command{\n\t\tUse:       \"package [outputfile]\",","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/peer/lifecycle/chaincode/package.go#L36-L72","documentation":"PackageInput.Validate returns this when the --lang flag is empty. The language selects which platform packager (golang, java, node) builds the deployment payload and it is also written into metadata.json. Packaging cannot proceed without a known chaincode language.","triggerScenarios":"Running `peer lifecycle chaincode package` without --lang, or with an unset variable like $CC_RUNTIME_LANGUAGE that expands to empty.","commonSituations":"CI scripts where CC_RUNTIME_LANGUAGE was never set; docs examples using golang but the flag removed while editing; automation generating the CLI args programmatically and skipping the language field.","solutions":["Add the flag: --lang golang (or java / node) to the package command.","Verify the shell variable (e.g. CC_RUNTIME_LANGUAGE) is exported and non-empty before the call.","Ensure the value matches a supported platform since validation only checks emptiness here but GetDeploymentPayload does strings.ToUpper(p.Input.Type) later."],"exampleFix":"// before\nargs := []string{\"-p\", path, \"--label\", label} // lang missing\n// after\nargs := []string{\"--lang\", \"golang\", \"--path\", path, \"--label\", label}","handlingStrategy":"validation","validationCode":"#!/bin/bash\ncase \"${CC_RUNTIME_LANGUAGE:-}\" in\n  golang|java|node) ;;\n  *) echo \"CC_RUNTIME_LANGUAGE must be golang, java, or node\"; exit 1 ;;\nesac\npeer lifecycle chaincode package \"$OUT\" --path \"$CC_SRC_PATH\" --lang \"$CC_RUNTIME_LANGUAGE\" --label \"$LABEL\"","typeGuard":null,"tryCatchPattern":"if ! out=$(peer lifecycle chaincode package \"$OUT\" --path \"$P\" --lang \"$L\" --label \"$LABEL\" 2>&1); then\n  case \"$out\" in\n    *\"chaincode language must be specified\"*) echo \"Add --lang golang|java|node\"; exit 2 ;;\n    *) echo \"$out\"; exit 1 ;;\n  esac\nfi","preventionTips":["Always pass --lang (golang/java/node) with the package command.","Guard language variables with ${VAR:?} in CI scripts.","Use lowercase language names; the tool uppercases internally.","Pin the language in pipeline variables so it cannot go empty."],"tags":["hyperledger-fabric","cli","validation","missing-flag"],"backgroundTag":"missing-required-argument","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"}