{"record":{"id":"b8032bbf3a3b38b8","repo":"getsops/sops","slug":"json-indentation-parameter-smaller-than-1-is-not","errorCode":null,"errorMessage":"JSON Indentation parameter smaller than -1 is not accepted","messagePattern":"JSON Indentation parameter smaller than -1 is not accepted","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"stores/json/store.go","lineNumber":310,"sourceCode":"\t\t\treturn nil, fmt.Errorf(\"SOPS only supports JSON files with a top-level object (starting with '{'), not arrays or other types. Got delimiter %s instead. To encrypt this file, wrap it in an object, e.g., {\\\"data\\\": [...]}\", value)\n\t\t}\n\t} else {\n\t\tv, nerr := normalizeJSONNumber(value)\n\t\tif nerr != nil {\n\t\t\tv = value\n\t\t}\n\t\treturn nil, fmt.Errorf(\"SOPS only supports JSON files with a top-level object (starting with '{'), not other JSON types. Got %#v of type %T instead\", v, v)\n\t}\n\treturn store.treeBranchFromJSONDecoder(dec)\n}\n\nfunc (store Store) reindentJSON(in []byte) ([]byte, error) {\n\tvar out bytes.Buffer\n\tindent := \"\\t\"\n\tif store.config.Indent > -1 {\n\t\tindent = strings.Repeat(\" \", store.config.Indent)\n\t} else if store.config.Indent < -1 {\n\t\treturn nil, errors.New(\"JSON Indentation parameter smaller than -1 is not accepted\")\n\t}\n\terr := json.Indent(&out, in, \"\", indent)\n\treturn out.Bytes(), err\n}\n\n// LoadEncryptedFile loads an encrypted secrets file onto a sops.Tree object\nfunc (store *Store) LoadEncryptedFile(in []byte) (sops.Tree, error) {\n\tbranches, err := store.LoadPlainFile(in)\n\tif err != nil {\n\t\treturn sops.Tree{}, err\n\t}\n\tbranches, metadata, err := stores.ExtractMetadata(branches, stores.MetadataOpts{\n\t\tFlatten: stores.MetadataFlattenNone,\n\t})\n\tif err != nil {\n\t\treturn sops.Tree{}, err\n\t}\n\treturn sops.Tree{","sourceCodeStart":292,"sourceCodeEnd":328,"githubUrl":"https://github.com/getsops/sops/blob/13442bb98183887d7a9ac09ec8ab0564673a59d8/stores/json/store.go#L292-L328","documentation":"Error \"JSON Indentation parameter smaller than -1 is not accepted\" thrown in getsops/sops.","triggerScenarios":"Thrown at stores/json/store.go:310 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"}