{"record":{"id":"244b7309a9818667","repo":"mikefarah/yq","slug":"v-cannot-modulo-by-v","errorCode":null,"errorMessage":"%v cannot modulo by %v","messagePattern":"(.+?) cannot modulo by (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/yqlib/operator_modulo.go","lineNumber":83,"sourceCode":"\t\ttarget.Style = lhs.Style\n\n\t\tlhsNum, err := strconv.ParseFloat(lhs.Value, 64)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\trhsNum, err := strconv.ParseFloat(rhs.Value, 64)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tremainder := math.Mod(lhsNum, rhsNum)\n\t\tif lhsIsCustom {\n\t\t\ttarget.Tag = lhs.Tag\n\t\t} else {\n\t\t\ttarget.Tag = \"!!float\"\n\t\t}\n\t\ttarget.Value = fmt.Sprintf(\"%v\", remainder)\n\t} else {\n\t\treturn fmt.Errorf(\"%v cannot modulo by %v\", lhsTag, rhsTag)\n\t}\n\treturn nil\n}\n","sourceCodeStart":65,"sourceCodeEnd":87,"githubUrl":"https://github.com/mikefarah/yq/blob/8b5af0694bb82b41d4ae180fac9972029066f90a/pkg/yqlib/operator_modulo.go#L65-L87","documentation":"moduloScalars reached its final else: the left/right tag pair is not int/int or numeric/numeric (custom types are unwrapped first). Combinations like !!str % !!int, or mixing booleans/nulls with numbers, have no modulo semantics defined, so both tags are reported and the operation aborted.","triggerScenarios":"Thrown at pkg/yqlib/operator_modulo.go:83 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Cast operands with tonumber before using %","Ensure both operands are numeric (no strings, nulls or bools)","Check the data for missing fields that default to null"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8b5af0694bb82b41d4ae180fac9972029066f90a","analyzedAt":"2026-09-05T10:57:22.766Z","contentChangedAt":"2026-09-05T10:57:22.766Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}