{"record":{"id":"c269fa5152818526","repo":"tomnomnom/gron","slug":"unexpected-data-type-for-merge-s","errorCode":null,"errorMessage":"unexpected data type for merge: `%s`","messagePattern":"unexpected data type for merge: `(.+?)`","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ungron.go","lineNumber":465,"sourceCode":"\t\tbMap, ok := b.(map[string]interface{})\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"cannot merge object with non-object\")\n\t\t}\n\t\treturn recursiveMapMerge(a.(map[string]interface{}), bMap)\n\n\tcase []interface{}:\n\t\tbSlice, ok := b.([]interface{})\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"cannot merge array with non-array\")\n\t\t}\n\t\treturn recursiveSliceMerge(a.([]interface{}), bSlice)\n\n\tcase string, int, float64, bool, nil, json.Number:\n\t\t// Can't merge them, second one wins\n\t\treturn b, nil\n\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unexpected data type for merge: `%s`\", reflect.TypeOf(a))\n\t}\n}\n\n// recursiveMapMerge recursively merges map[string]interface{} values\nfunc recursiveMapMerge(a, b map[string]interface{}) (map[string]interface{}, error) {\n\t// Merge keys from b into a\n\tfor k, v := range b {\n\t\t_, exists := a[k]\n\t\tif !exists {\n\t\t\t// Doesn't exist in a, just add it in\n\t\t\ta[k] = v\n\t\t} else {\n\t\t\t// Does exist, merge the values\n\t\t\tmerged, err := recursiveMerge(a[k], b[k])\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n","sourceCodeStart":447,"sourceCodeEnd":483,"githubUrl":"https://github.com/tomnomnom/gron/blob/88a6234ea2d0c487090988182ad9a7cdf6def924/ungron.go#L447-L483","documentation":"recursiveMerge received a value of an unhandled dynamic type for its first argument (a): it handles maps, slices and scalar kinds (string, int, float64, bool, nil, json.Number), so anything else — an unexpected concrete type in the parsed tree — falls to the default branch. This signals an internal datastructure bug rather than bad user input.","triggerScenarios":"Thrown at ungron.go:465 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Report/inspect the value's reflect.Type shown in the message to find where the unexpected type entered the parsed tree","Extend recursiveMerge to handle the new type if it is legitimately produced by parsing"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"88a6234ea2d0c487090988182ad9a7cdf6def924","analyzedAt":"2026-09-06T11:35:31.658Z","contentChangedAt":"2026-09-06T11:35:31.658Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}