{"record":{"id":"0edd572393deeff0","repo":"hyperledger/fabric","slug":"unknown-rule-type-s-expected-all-any-or-majo","errorCode":null,"errorMessage":"unknown rule type '%s', expected ALL, ANY, or MAJORITY","messagePattern":"unknown rule type '(.+?)', expected ALL, ANY, or MAJORITY","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/policies/implicitmetaparser.go","lineNumber":34,"sourceCode":"func ImplicitMetaFromString(input string) (*cb.ImplicitMetaPolicy, error) {\n\targs := strings.Split(input, \" \")\n\tif len(args) != 2 {\n\t\treturn nil, errors.Errorf(\"expected two space separated tokens, but got %d\", len(args))\n\t}\n\n\tres := &cb.ImplicitMetaPolicy{\n\t\tSubPolicy: args[1],\n\t}\n\n\tswitch args[0] {\n\tcase cb.ImplicitMetaPolicy_ANY.String():\n\t\tres.Rule = cb.ImplicitMetaPolicy_ANY\n\tcase cb.ImplicitMetaPolicy_ALL.String():\n\t\tres.Rule = cb.ImplicitMetaPolicy_ALL\n\tcase cb.ImplicitMetaPolicy_MAJORITY.String():\n\t\tres.Rule = cb.ImplicitMetaPolicy_MAJORITY\n\tdefault:\n\t\treturn nil, errors.Errorf(\"unknown rule type '%s', expected ALL, ANY, or MAJORITY\", args[0])\n\t}\n\n\treturn res, nil\n}\n","sourceCodeStart":16,"sourceCodeEnd":39,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/common/policies/implicitmetaparser.go#L16-L39","documentation":"Returned by ImplicitMetaFromString when the first space-separated token of an implicit-meta policy string is not one of ANY, ALL, or MAJORITY — e.g. 'SOME org.admin'. The rule keyword itself is unrecognized, so the policy cannot be compiled to an ImplicitMetaPolicy.","triggerScenarios":"Calling ImplicitMetaFromString with a first token that is not exactly 'ANY', 'ALL', or 'MAJORITY' (case-sensitive), e.g. 'any Readers', 'MOST Admins', or a reversed input like 'Readers ANY'.","commonSituations":"Lowercase rule keywords in configtx.yaml; accidentally swapping the token order ('Readers ANY'); inventing rule names that the implicit meta parser does not support.","solutions":["Use one of the exact uppercase keywords: ALL, ANY, or MAJORITY as the first token","Correct token order so the rule precedes the sub-policy name ('ANY Readers', not 'Readers ANY')","Check for case sensitivity issues introduced by templating or generation of the config"],"exampleFix":"// before\nImplicitMetaFromString(\"any Readers\")\n// after\nImplicitMetaFromString(\"ANY Readers\")","handlingStrategy":"validation","validationCode":"func validRule(s string) bool {\n  switch s {\n  case \"ALL\", \"ANY\", \"MAJORITY\": return true\n  }\n  return false\n}\nfirst := strings.Fields(input)[0]\n// require validRule(first) before ImplicitMetaFromString","typeGuard":null,"tryCatchPattern":"policy, err := policies.ImplicitMetaFromString(input)\nif err != nil && strings.Contains(err.Error(), \"unknown rule type\") {\n  return fmt.Errorf(\"rule must be ALL/ANY/MAJORITY (exact case), got: %v\", err)\n}","preventionTips":["Use exact uppercase rule keywords; the parser is case-sensitive","Keep the rule token first: 'RULE SubPolicy'","Lint configtx.yaml policy strings against ^(ALL|ANY|MAJORITY) [A-Za-z]+$"],"tags":["hyperledger-fabric","parsing","policy-config"],"backgroundTag":"malformed-policy-string","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"}