{"record":{"id":"4c4bf0e092170a15","repo":"getsops/sops","slug":"error-marshaling-metadata-s-4c4bf0","errorCode":null,"errorMessage":"Error marshaling metadata: %s","messagePattern":"Error marshaling metadata: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"stores/yaml/store.go","lineNumber":368,"sourceCode":"}\n\nfunc (store *Store) getIndentation() (int, error) {\n\tif store.config.Indent > 0 {\n\t\treturn store.config.Indent, nil\n\t} else if store.config.Indent < 0 {\n\t\treturn 0, errors.New(\"YAML Negative indentation not accepted\")\n\t}\n\treturn IndentDefault, nil\n}\n\n// EmitEncryptedFile returns the encrypted bytes of the yaml file corresponding to a\n// sops.Tree runtime object\nfunc (store *Store) EmitEncryptedFile(in sops.Tree) ([]byte, error) {\n\tbranches, err := stores.SerializeMetadata(in, stores.MetadataOpts{\n\t\tFlatten: stores.MetadataFlattenNone,\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error marshaling metadata: %s\", err)\n\t}\n\treturn store.EmitPlainFile(branches)\n}\n\n// EmitPlainFile returns the plaintext bytes of the yaml file corresponding to a\n// sops.TreeBranches runtime object\nfunc (store *Store) EmitPlainFile(branches sops.TreeBranches) ([]byte, error) {\n\tvar b bytes.Buffer\n\te := yaml.NewEncoder(io.Writer(&b))\n\tindent, err := store.getIndentation()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\te.SetIndent(indent)\n\tfor _, branch := range branches {\n\t\t// Document root\n\t\tvar doc = yaml.Node{}\n\t\tdoc.Kind = yaml.DocumentNode","sourceCodeStart":350,"sourceCodeEnd":386,"githubUrl":"https://github.com/getsops/sops/blob/13442bb98183887d7a9ac09ec8ab0564673a59d8/stores/yaml/store.go#L350-L386","documentation":"Error \"Error marshaling metadata: %s\" thrown in getsops/sops.","triggerScenarios":"Thrown at stores/yaml/store.go:368 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"}