{"record":{"id":"491d348f17a0480a","repo":"hyperledger/fabric","slug":"this-evaluator-only-understands-messages-of-versio","errorCode":null,"errorMessage":"This evaluator only understands messages of version 0, but version was %d","messagePattern":"This evaluator only understands messages of version 0, but version was (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/cauthdsl/policy.go","lineNumber":39,"sourceCode":"\tdeserializer msp.IdentityDeserializer\n}\n\n// NewPolicyProvider provides a policy generator for cauthdsl type policies\nfunc NewPolicyProvider(deserializer msp.IdentityDeserializer) policies.Provider {\n\treturn &provider{\n\t\tdeserializer: deserializer,\n\t}\n}\n\n// NewPolicy creates a new policy based on the policy bytes\nfunc (pr *provider) NewPolicy(data []byte) (policies.Policy, proto.Message, error) {\n\tsigPolicy := &cb.SignaturePolicyEnvelope{}\n\tif err := proto.Unmarshal(data, sigPolicy); err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"Error unmarshalling to SignaturePolicy: %s\", err)\n\t}\n\n\tif sigPolicy.Version != 0 {\n\t\treturn nil, nil, fmt.Errorf(\"This evaluator only understands messages of version 0, but version was %d\", sigPolicy.Version)\n\t}\n\n\tcompiled, err := compile(sigPolicy.Rule, sigPolicy.Identities)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn &policy{\n\t\tevaluator:               compiled,\n\t\tdeserializer:            pr.deserializer,\n\t\tsignaturePolicyEnvelope: sigPolicy,\n\t}, sigPolicy, nil\n}\n\n// EnvelopeBasedPolicyProvider allows to create a new policy from SignaturePolicyEnvelope struct instead of []byte\ntype EnvelopeBasedPolicyProvider struct {\n\tDeserializer msp.IdentityDeserializer\n}","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/common/cauthdsl/policy.go#L21-L57","documentation":"Guard in EnvelopeBasedPolicyProvider/evaluator: the SignaturePolicyEnvelope carried a Version other than 0, the only policy version this evaluator understands, so the policy bytes are from an incompatible schema.","triggerScenarios":"Calling NewPolicy (via NewManagerImpl) with a valid SignaturePolicyEnvelope whose Version field was serialized as nonzero — typically written by a newer schema/tooling that bumped Version.","commonSituations":"Policy generated by a Fabric tool version ahead of the running evaluator; hand-edited proto where Version defaulted incorrectly after a copy; schema evolution experiments.","solutions":["Set the envelope Version to 0 before serializing, or regenerate with compatible tooling","Align the evaluator (library) and producer (tooling) on the same Fabric version","Validate sigPolicy.Version == 0 in policy-generation code before persisting"],"exampleFix":"// before\nenv := &cb.SignaturePolicyEnvelope{Version: 1, Rule: rule, Identities: ids}\n// after\nenv := &cb.SignaturePolicyEnvelope{Version: 0, Rule: rule, Identities: ids}","handlingStrategy":"validation","validationCode":"if env.Version != 0 {\n    return fmt.Errorf(\"unsupported SignaturePolicyEnvelope version %d; only 0 accepted\", env.Version)\n}","typeGuard":"func isV0Envelope(env *cb.SignaturePolicyEnvelope) bool { return env != nil && env.Version == 0 }","tryCatchPattern":"policy, _, err := provider.NewPolicy(data)\nif err != nil && strings.Contains(err.Error(), \"version 0\") {\n    return fmt.Errorf(\"policy produced by incompatible Fabric version: %w\", err)\n}","preventionTips":["Keep policy-producing tooling and the evaluator on compatible Fabric versions","Explicitly set Version: 0 when constructing envelopes","Validate version before persisting policies to config"],"tags":["policy","version-mismatch","protobuf"],"backgroundTag":"proto-version-mismatch","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"}