{"record":{"id":"0535dd3304499b42","repo":"getsops/sops","slug":"binary-files-are-not-structured-and-extracting-a-s","errorCode":null,"errorMessage":"Binary files are not structured and extracting a single value is not possible","messagePattern":"Binary files are not structured and extracting a single value is not possible","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"stores/json/store.go","lineNumber":96,"sourceCode":"\t\treturn nil, fmt.Errorf(\"%w: there must be exactly one tree branch\", BinaryStoreEmitPlainError)\n\t}\n\t// JSON stores a single object per file\n\tfor _, item := range in[0] {\n\t\tif item.Key == \"data\" {\n\t\t\tif value, ok := item.Value.(string); ok {\n\t\t\t\treturn []byte(value), nil\n\t\t\t} else {\n\t\t\t\treturn nil, fmt.Errorf(\"%w: 'data' key in tree does not have a string value\", BinaryStoreEmitPlainError)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"%w: no binary data found in tree\", BinaryStoreEmitPlainError)\n}\n\n// EmitValue extracts a value from a generic interface{} object representing a structured set\n// of binary files\nfunc (store BinaryStore) EmitValue(v interface{}) ([]byte, error) {\n\treturn nil, fmt.Errorf(\"Binary files are not structured and extracting a single value is not possible\")\n}\n\n// EmitExample returns the example's plaintext json file bytes\nfunc (store BinaryStore) EmitExample() []byte {\n\treturn []byte(\"Welcome to SOPS! Edit this file as you please!\")\n}\n\nfunc (store Store) sliceFromJSONDecoder(dec *json.Decoder) ([]interface{}, error) {\n\tvar slice []interface{}\n\tfor {\n\t\tt, err := dec.Token()\n\t\tif err != nil {\n\t\t\treturn slice, err\n\t\t}\n\t\tif delim, ok := t.(json.Delim); ok && delim.String() == \"]\" {\n\t\t\treturn slice, nil\n\t\t} else if ok && delim.String() == \"{\" {\n\t\t\titem, err := store.treeBranchFromJSONDecoder(dec)","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/getsops/sops/blob/13442bb98183887d7a9ac09ec8ab0564673a59d8/stores/json/store.go#L78-L114","documentation":"Error \"Binary files are not structured and extracting a single value is not possible\" thrown in getsops/sops.","triggerScenarios":"Thrown at stores/json/store.go:96 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"}