{"record":{"id":"650249f72b3b4a35","repo":"getsops/sops","slug":"all-parts-must-be-the-same-length","errorCode":null,"errorMessage":"all parts must be the same length","messagePattern":"all parts must be the same length","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shamir/shamir.go","lineNumber":269,"sourceCode":"\treturn out, nil\n}\n\n// Combine is used to reverse a Split and reconstruct a secret\n// once a `threshold` number of parts are available.\nfunc Combine(parts [][]byte) ([]byte, error) {\n\t// Verify enough parts provided\n\tif len(parts) < 2 {\n\t\treturn nil, fmt.Errorf(\"less than two parts cannot be used to reconstruct the secret\")\n\t}\n\n\t// Verify the parts are all the same length\n\tfirstPartLen := len(parts[0])\n\tif firstPartLen < 2 {\n\t\treturn nil, fmt.Errorf(\"parts must be at least two bytes\")\n\t}\n\tfor i := 1; i < len(parts); i++ {\n\t\tif len(parts[i]) != firstPartLen {\n\t\t\treturn nil, fmt.Errorf(\"all parts must be the same length\")\n\t\t}\n\t}\n\n\t// Create a buffer to store the reconstructed secret\n\tsecret := make([]byte, firstPartLen-1)\n\n\t// Buffer to store the samples\n\txSamples := make([]uint8, len(parts))\n\tySamples := make([]uint8, len(parts))\n\n\t// Set the x value for each sample and ensure no x_sample values are the same,\n\t// otherwise div() can be unhappy\n\t// Check that we don't have any duplicate parts, that is, two or\n\t// more parts with the same x coordinate.\n\tcheckMap := map[byte]bool{}\n\tfor i, part := range parts {\n\t\tsamp := part[firstPartLen-1]\n\t\tif exists := checkMap[samp]; exists {","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/getsops/sops/blob/13442bb98183887d7a9ac09ec8ab0564673a59d8/shamir/shamir.go#L251-L287","documentation":"Error \"all parts must be the same length\" thrown in getsops/sops.","triggerScenarios":"Thrown at shamir/shamir.go:269 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"}