{"record":{"id":"caf8c715932e8edb","repo":"hyperledger/fabric","slug":"policy-s-at-path-s-did-not-compile","errorCode":null,"errorMessage":"policy %s at path %s did not compile","messagePattern":"policy (.+?) at path (.+?) did not compile","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/policies/policy.go","lineNumber":225,"sourceCode":"\n\t\tvar cPolicy Policy\n\n\t\tif policy.Type == int32(cb.Policy_IMPLICIT_META) {\n\t\t\timp, err := NewImplicitMetaPolicy(policy.Value, managers)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrapf(err, \"implicit policy %s at path %s did not compile\", policyName, path)\n\t\t\t}\n\t\t\tcPolicy = imp\n\t\t} else {\n\t\t\tprovider, ok := providers[policy.Type]\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"policy %s at path %s has unknown policy type: %v\", policyName, path, policy.Type)\n\t\t\t}\n\n\t\t\tvar err error\n\t\t\tcPolicy, _, err = provider.NewPolicy(policy.Value)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrapf(err, \"policy %s at path %s did not compile\", policyName, path)\n\t\t\t}\n\t\t}\n\n\t\tpolicies[policyName] = cPolicy\n\n\t\tlogger.Debugf(\"Proposed new policy %s for %s\", policyName, path)\n\t}\n\n\tfor groupName, manager := range managers {\n\t\tfor policyName, policy := range manager.Policies {\n\t\t\tpolicies[groupName+PathSeparator+policyName] = policy\n\t\t}\n\t}\n\n\treturn &ManagerImpl{\n\t\tpath:     path,\n\t\tPolicies: policies,\n\t\tmanagers: managers,","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/common/policies/policy.go#L207-L243","documentation":"After a provider is found, NewManagerImpl calls provider.NewPolicy(policy.Value) to compile the policy body (e.g. a SignaturePolicyEnvelope). Compilation failures are wrapped with this message identifying the policy and config path.","triggerScenarios":"Calling NewManagerImpl where a signature-type policy's Value bytes do not unmarshal/compile into a valid SignaturePolicyEnvelope, e.g. corrupted protobuf bytes or an envelope with unresolvable principals.","commonSituations":"Channel update carried a hand-crafted signature policy envelope that fails validation; policy value bytes truncated or corrupted during config editing; principal references (MSP IDs, roles) invalid for the deployed configuration.","solutions":["Regenerate the policy value with the intended policy builder (e.g. cauthdsl helpers) instead of hand-editing bytes","Validate the policy envelope proto before committing it to channel config","Inspect the wrapped cause (errors.Unwrap) for the underlying compile failure and fix accordingly"],"exampleFix":"// before: hand-assembled invalid envelope bytes\nPolicy{Type: SIGNATURE, Value: badBytes}\n// after\nenv := cauthdsl.SignedByMspMember(\"Org1MSP\")\nval, _ := proto.Marshal(env)\nPolicy{Type: SIGNATURE, Value: val}","handlingStrategy":"try-catch","validationCode":"// Compile-check signature policy values before committing\nvar env cb.SignaturePolicyEnvelope\nif err := proto.Unmarshal(p.Value, &env); err != nil {\n  return fmt.Errorf(\"policy value is not a valid envelope: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"mgr, err := policies.NewManagerImpl(root, path, providers)\nif err != nil && strings.Contains(err.Error(), \"did not compile\") {\n  cause := errors.Unwrap(err)\n  return fmt.Errorf(\"policy body invalid (%v): regenerate with cauthdsl\", cause)\n}","preventionTips":["Build signature policies with cauthdsl helpers, never hand-crafted bytes","Unmarshal and validate envelopes before writing them into config","Keep principal/MSP references consistent with deployed orgs"],"tags":["hyperledger-fabric","channel-config","policy-compilation"],"backgroundTag":"policy-compilation-failed","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"}