{"record":{"id":"7586e9b9da52090e","repo":"mikefarah/yq","slug":"v-cannot-be-divided-by-v","errorCode":null,"errorMessage":"%v cannot be divided by %v","messagePattern":"(.+?) cannot be divided by (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/yqlib/operator_divide.go","lineNumber":68,"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\tquotient := 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\", quotient)\n\t} else {\n\t\treturn fmt.Errorf(\"%v cannot be divided by %v\", lhsTag, rhsTag)\n\t}\n\treturn nil\n}\n","sourceCodeStart":50,"sourceCodeEnd":72,"githubUrl":"https://github.com/mikefarah/yq/blob/8b5af0694bb82b41d4ae180fac9972029066f90a/pkg/yqlib/operator_divide.go#L50-L72","documentation":"divideScalars reached its final else: the left/right scalar tag pair is not one of the supported numeric or string/string combinations. Division is only defined for int/int, int/float, float/float (and string splitting handled elsewhere), so pairs like !!str / !!int end here with both tags printed.","triggerScenarios":"Thrown at pkg/yqlib/operator_divide.go:68 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Cast operands with tonumber before dividing","For splitting a string, use the string/string form: \"a,b\" / \",\"","Check that the data does not contain nulls or booleans where numbers were expected"],"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"}