hyperledger/fabric · error
invalid signed deployment spec
Error message
invalid signed deployment spec
What it means
After extracting the signed deployment spec, SignExistingPackage validates that the SignedChaincodeDeploymentSpec contains all required parts: the serialized ChaincodeDeploymentSpec, InstantiationPolicy and OwnerEndorsements. If any is nil/missing the spec is considered invalid and cannot be re-signed.
Source
Thrown at core/common/ccpackage/ccpackage.go:218
}
// SignExistingPackage adds a signature to a signed package.
func SignExistingPackage(env *common.Envelope, owner identity.SignerSerializer) (*common.Envelope, error) {
if owner == nil {
return nil, errors.New("owner not provided")
}
ch, sdepspec, err := ExtractSignedCCDepSpec(env)
if err != nil {
return nil, err
}
if ch == nil {
return nil, errors.New("channel header not found in the envelope")
}
if sdepspec == nil || sdepspec.ChaincodeDeploymentSpec == nil || sdepspec.InstantiationPolicy == nil || sdepspec.OwnerEndorsements == nil {
return nil, errors.New("invalid signed deployment spec")
}
// serialize the signing identity
endorser, err := owner.Serialize()
if err != nil {
return nil, fmt.Errorf("Could not serialize the signing identity: %s", err)
}
// sign the concatenation of cds, instpolicy and the serialized endorser identity with this endorser's key
signature, err := owner.Sign(append(sdepspec.ChaincodeDeploymentSpec, append(sdepspec.InstantiationPolicy, endorser...)...))
if err != nil {
return nil, fmt.Errorf("Could not sign the ccpackage, err %s", err)
}
endorsements := append(sdepspec.OwnerEndorsements, &peer.Endorsement{Signature: signature, Endorser: endorser})
return createSignedCCDepSpec(sdepspec.ChaincodeDeploymentSpec, sdepspec.InstantiationPolicy, endorsements)
}View on GitHub (pinned to 2736b63f8f)
Solutions
- Regenerate the package with OwnerCreateSignedCCDepSpec (which always sets all three fields) instead of re-signing a corrupt one
- Validate the package: ExtractSignedCCDepSpec then check sdepspec.ChaincodeDeploymentSpec, InstantiationPolicy and OwnerEndorsements are non-nil before calling SignExistingPackage
- Re-download or re-export the original package file if it was corrupted in transit
Example fix
// before
env, err := ccpackage.SignExistingPackage(env, signer)
// after
_, sdepspec, err := ccpackage.ExtractSignedCCDepSpec(env)
if err != nil || sdepspec == nil || sdepspec.ChaincodeDeploymentSpec == nil || sdepspec.InstantiationPolicy == nil || sdepspec.OwnerEndorsements == nil {
return errors.New("package is not a complete signed CDS; regenerate it")
}
env, err = ccpackage.SignExistingPackage(env, signer) Defensive patterns
Strategy: validation
Validate before calling
_, sdepspec, err := ccpackage.ExtractSignedCCDepSpec(env)
if err != nil || sdepspec == nil || sdepspec.ChaincodeDeploymentSpec == nil || sdepspec.InstantiationPolicy == nil || sdepspec.OwnerEndorsements == nil {
return errors.New("package incomplete; regenerate with OwnerCreateSignedCCDepSpec")
}
env, err = ccpackage.SignExistingPackage(env, owner) Type guard
func isCompleteSignedCDS(s *peer.SignedChaincodeDeploymentSpec) bool {
return s != nil && len(s.ChaincodeDeploymentSpec) > 0 && s.InstantiationPolicy != nil && s.OwnerEndorsements != nil
} Try / catch
env, err := ccpackage.SignExistingPackage(env, owner)
if err != nil {
if strings.Contains(err.Error(), "invalid signed deployment spec") {
return fmt.Errorf("package corrupted or foreign format: %w", err)
}
return err
} Prevention
- Validate packages after writing them to disk (extract and re-check fields)
- Generate packages only via ccpackage helpers
- Checksum package files to detect corruption in transit
When it happens
Trigger: Re-signing an envelope whose SignedChaincodeDeploymentSpec lacks ChaincodeDeploymentSpec bytes, has no InstantiationPolicy, or has nil OwnerEndorsements — typically a corrupted or partially written package file, or a foreign/envelope not produced by ccpackage.
Common situations: Package files truncated on disk or edited by hand; packages built by external tools omitting OwnerEndorsements; cross-version incompatibilities where older packaging code omitted fields; passing a raw CDS envelope instead of a signed one.
Related errors
- channel header not found in the envelope
- at least one TransactionAction required
- '%s' not equal <newest|oldest|config|(number)>
- unmarshalling block: %s
- specified --channelID %s does not match channel ID %s in con
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/43d148ec6f198edf.
Report an issue: GitHub.