{"record":{"id":"7262a26551e1cc69","repo":"getsops/sops","slug":"type-mismatch","errorCode":null,"errorMessage":"Type mismatch","messagePattern":"Type mismatch","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"stores/flatten.go","lineNumber":123,"sourceCode":"\t\treturn fmt.Errorf(\"Duplicate value\")\n\t}\n\troot.value = value\n\treturn nil\n}\n\nfunc b2i(value bool) int {\n\tif value {\n\t\treturn 1\n\t}\n\treturn 0\n}\n\nfunc convert(root *node) (interface{}, error) {\n\thasValue := root.value != nil\n\thasSubkey := len(root.subkeys) > 0\n\thasIndex := len(root.indices) > 0\n\tif b2i(hasValue)+b2i(hasSubkey)+b2i(hasIndex) > 1 {\n\t\treturn nil, fmt.Errorf(\"Type mismatch\")\n\t}\n\tif !hasValue && !hasSubkey && !hasIndex {\n\t\treturn sops.TreeBranch{}, nil\n\t}\n\tif hasValue {\n\t\treturn *root.value, nil\n\t}\n\tif hasSubkey {\n\t\tkeys := make([]string, len(root.subkeys))\n\t\tindex := 0\n\t\tfor k := range root.subkeys {\n\t\t\tkeys[index] = k\n\t\t\tindex += 1\n\t\t}\n\t\tsort.Strings(keys)\n\t\tresult := make(sops.TreeBranch, len(keys))\n\t\tfor index, key := range keys {\n\t\t\tvalue, err := convert(root.subkeys[key])","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/getsops/sops/blob/13442bb98183887d7a9ac09ec8ab0564673a59d8/stores/flatten.go#L105-L141","documentation":"Error \"Type mismatch\" thrown in getsops/sops.","triggerScenarios":"Thrown at stores/flatten.go:123 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"13442bb98183887d7a9ac09ec8ab0564673a59d8","analyzedAt":"2026-09-01T03:53:00.447Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}