{"record":{"id":"839da5f00199db9d","repo":"nodejs/node","slug":"attempt-to-merge-dict-value-of-unsupported-type-v","errorCode":null,"errorMessage":"Attempt to merge dict value of unsupported type {v.__class__.__name__} for key {k}","messagePattern":"Attempt to merge dict value of unsupported type (.+?) for key (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"tools/gyp/pylib/gyp/input.py","lineNumber":2378,"sourceCode":"                        + to[list_base].__class__.__name__\n                        + \" for key \"\n                        + list_base\n                        + \"(\"\n                        + k\n                        + \")\"\n                    )\n            else:\n                to[list_base] = []\n\n            # Call MergeLists, which will make copies of objects that require it.\n            # MergeLists can recurse back into MergeDicts, although this will be\n            # to make copies of dicts (with paths fixed), there will be no\n            # subsequent dict \"merging\" once entering a list because lists are\n            # always replaced, appended to, or prepended to.\n            is_paths = IsPathSection(list_base)\n            MergeLists(to[list_base], v, to_file, fro_file, is_paths, append)\n        else:\n            raise TypeError(\n                \"Attempt to merge dict value of unsupported type \"\n                + v.__class__.__name__\n                + \" for key \"\n                + k\n            )\n\n\ndef MergeConfigWithInheritance(\n    new_configuration_dict, build_file, target_dict, configuration, visited\n):\n    # Skip if previously visited.\n    if configuration in visited:\n        return\n\n    # Look at this configuration.\n    configuration_dict = target_dict[\"configurations\"][configuration]\n\n    # Merge in parents.","sourceCodeStart":2360,"sourceCodeEnd":2396,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/tools/gyp/pylib/gyp/input.py#L2360-L2396","documentation":"The final else in MergeDicts: a dict value 'v' is not one of the supported types (str, int, dict, or list). For example None, float, tuple, set, or a custom object as a dict value raises TypeError naming the type and key.","triggerScenarios":"During a dict merge, a value associated with some key k is a type MergeDicts cannot handle — str/int/dict/list are the only accepted value types.","commonSituations":"A variable expanding to None used as a dict value; floats in settings; tuples/sets accidentally introduced by generators; boolean values (type bool) which are NOT matched by `type(v) in (str,int)` and thus fall through.","solutions":["Make every dict value a str, int, dict, or list.","Replace None expansions with concrete strings or remove the key.","Cast floats/bools to str or int as appropriate.","Inspect generator-emitted dicts for non-standard value types."],"exampleFix":"// before: { 'defines': None }\n// after: { 'defines': [] }","handlingStrategy":"type-guard","validationCode":"def clean_dict(d):\n    for k, v in d.items():\n        if type(v) not in (str, int) and not isinstance(v, (dict, list)):\n            raise TypeError('unsupported dict value type for %s: %r' % (k, type(v)))\n","typeGuard":"def is_mergeable_value(v): return type(v) in (str,int) or isinstance(v, (dict,list)) and type(v) is not bool","tryCatchPattern":"try:\n    MergeDicts(to, fro, to_file, fro_file)\nexcept TypeError as e:\n    if 'unsupported type' in str(e): print('Reduce dict values to str/int/dict/list'); raise","preventionTips":["Restrict dict values to str/int/dict/list; reject None/bool/float/tuple/set.","Avoid variable expansions that yield None.","Validate generator output types."],"tags":["gyp","merge","type-error","validation","build-config"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}