{"record":{"id":"01db1d412b904d92","repo":"getsops/sops","slug":"error-encoding-key-s-s","errorCode":null,"errorMessage":"Error encoding key %s: %s","messagePattern":"Error encoding key (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"stores/json/store.go","lineNumber":264,"sourceCode":"}\n\nfunc (store Store) encodeTree(tree sops.TreeBranch) ([]byte, error) {\n\tout := \"{\"\n\tempty := true\n\tfor _, item := range tree {\n\t\tif _, ok := item.Key.(sops.Comment); ok {\n\t\t\tcontinue\n\t\t}\n\t\tif !empty {\n\t\t\tout += \",\"\n\t\t}\n\t\tv, err := store.encodeValue(item.Value)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Error encoding value %s: %s\", v, err)\n\t\t}\n\t\tk, err := json.Marshal(item.Key.(string))\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Error encoding key %s: %s\", k, err)\n\t\t}\n\t\tout += string(k) + `: ` + string(v)\n\t\tempty = false\n\t}\n\treturn []byte(out + \"}\"), nil\n}\n\nfunc (store Store) jsonFromTreeBranch(branch sops.TreeBranch) ([]byte, error) {\n\tout, err := store.encodeTree(branch)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn store.reindentJSON(out)\n}\n\nfunc (store Store) treeBranchFromJSON(in []byte) (sops.TreeBranch, error) {\n\tdec := json.NewDecoder(bytes.NewReader(in))\n\t// Decode numbers as json.Number instead of the default float64, then","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/getsops/sops/blob/13442bb98183887d7a9ac09ec8ab0564673a59d8/stores/json/store.go#L246-L282","documentation":"Error \"Error encoding key %s: %s\" thrown in getsops/sops.","triggerScenarios":"Thrown at stores/json/store.go:264 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"}