{"record":{"id":"102782e8a4a3835e","repo":"hyperledger/fabric","slug":"path-element-at-d-is-invalid","errorCode":null,"errorMessage":"path element at %d is invalid","messagePattern":"path element at (.+?) is invalid","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/configtx/update.go","lineNumber":62,"sourceCode":"\t\tresult[key] = value\n\t}\n\treturn result\n}\n\nfunc validateModPolicy(modPolicy string) error {\n\tif modPolicy == \"\" {\n\t\treturn errors.Errorf(\"mod_policy not set\")\n\t}\n\n\ttrimmed := modPolicy\n\tif modPolicy[0] == '/' {\n\t\ttrimmed = modPolicy[1:]\n\t}\n\n\tfor i, pathElement := range strings.Split(trimmed, pathSeparator) {\n\t\terr := validateConfigID(pathElement)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"path element at %d is invalid\", i)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (vi *ValidatorImpl) verifyDeltaSet(deltaSet map[string]comparable, signedData []*protoutil.SignedData) error {\n\tif len(deltaSet) == 0 {\n\t\treturn errors.Errorf(\"delta set was empty -- update would have no effect\")\n\t}\n\n\tfor key, value := range deltaSet {\n\t\tlogger.Debugf(\"Processing change to key: %s\", key)\n\t\tif err := validateModPolicy(value.modPolicy()); err != nil {\n\t\t\treturn errors.Wrapf(err, \"invalid mod_policy for element %s\", key)\n\t\t}\n\n\t\texisting, ok := vi.configMap[key]\n\t\tif !ok {","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/common/configtx/update.go#L44-L80","documentation":"validateModPolicy splits the mod_policy on path separators and validates each element with validateConfigID. This error wraps the underlying validateConfigID failure, indicating some segment of the mod_policy path is empty or contains characters disallowed in config IDs.","triggerScenarios":"A mod_policy like '/Channel//Admins' (empty element), or one containing invalid characters such as spaces or control characters, fails validateConfigID.","commonSituations":"Typos or double slashes in policy names in configtx.yaml or generated config; whitespace accidentally included in policy references.","solutions":["Fix the mod_policy string so each '/'-separated element is a valid config ID (non-empty, no illegal characters).","Remove duplicated path separators or trailing slashes.","Validate generated policy names before submitting the update."],"exampleFix":"// before\nModPolicy: \"/Channel/Application//Admins\"\n// after\nModPolicy: \"/Channel/Application/Admins\"","handlingStrategy":"validation","validationCode":"func validModPolicyPath(p string) error {\n  for i, el := range strings.Split(strings.TrimPrefix(p, \"/\"), \"/\") {\n    if el == \"\" || strings.ContainsAny(el, \" \\t\") {\n      return fmt.Errorf(\"invalid path element %d in %q\", i, p)\n    }\n  }\n  return nil\n}","typeGuard":"func isWellFormedModPolicy(p string) bool { return p != \"\" && !strings.Contains(p, \"//\") && strings.TrimSpace(p) == p }","tryCatchPattern":"if err := validateModPolicy(el.GetModPolicy()); err != nil {\n  return fmt.Errorf(\"fix mod_policy path %q: %w\", el.GetModPolicy(), err)\n}","preventionTips":["Keep policy names alphanumeric with dashes/dots only","Avoid double slashes and trailing slashes in policy paths","Trim whitespace from policy names read from YAML config"],"tags":["hyperledger-fabric","configtx","mod-policy"],"backgroundTag":"mod-policy-not-set","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"}