tomnomnom/gron · error
unexpected data type for merge: `%s`
Error message
unexpected data type for merge: `%s`
What it means
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.
Source
Thrown at ungron.go:465
bMap, ok := b.(map[string]interface{})
if !ok {
return nil, fmt.Errorf("cannot merge object with non-object")
}
return recursiveMapMerge(a.(map[string]interface{}), bMap)
case []interface{}:
bSlice, ok := b.([]interface{})
if !ok {
return nil, fmt.Errorf("cannot merge array with non-array")
}
return recursiveSliceMerge(a.([]interface{}), bSlice)
case string, int, float64, bool, nil, json.Number:
// Can't merge them, second one wins
return b, nil
default:
return nil, fmt.Errorf("unexpected data type for merge: `%s`", reflect.TypeOf(a))
}
}
// recursiveMapMerge recursively merges map[string]interface{} values
func recursiveMapMerge(a, b map[string]interface{}) (map[string]interface{}, error) {
// Merge keys from b into a
for k, v := range b {
_, exists := a[k]
if !exists {
// Doesn't exist in a, just add it in
a[k] = v
} else {
// Does exist, merge the values
merged, err := recursiveMerge(a[k], b[k])
if err != nil {
return nil, err
}
View on GitHub (pinned to 88a6234ea2)
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
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at ungron.go:465 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tomnomnom/gron@88a6234ea2 (2026-09-06).
Data as JSON: /api/errors/c269fa5152818526.
Report an issue: GitHub.