{"record":{"id":"338f6b5cd79fa0de","repo":"nodejs/node","slug":"unknown-type-item-class-name-at-index-i","errorCode":null,"errorMessage":"Unknown type {item.__class__.__name__} at index {index}","messagePattern":"Unknown type (.+?) at index (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"tools/gyp/pylib/gyp/input.py","lineNumber":1432,"sourceCode":"            if type(expanded) in (str, int):\n                the_list[index] = expanded\n            elif isinstance(expanded, list):\n                the_list[index : index + 1] = expanded\n                index += len(expanded)\n\n                # index now identifies the next item to examine.  Continue right now\n                # without falling into the index increment below.\n                continue\n            else:\n                raise ValueError(\n                    \"Variable expansion in this context permits strings and \"\n                    + \"lists only, found \"\n                    + expanded.__class__.__name__\n                    + \" at \"\n                    + index\n                )\n        elif not isinstance(item, int):\n            raise TypeError(\n                \"Unknown type \" + item.__class__.__name__ + \" at index \" + index\n            )\n        index = index + 1\n\n\ndef BuildTargetsDict(data):\n    \"\"\"Builds a dict mapping fully-qualified target names to their target dicts.\n\n    |data| is a dict mapping loaded build files by pathname relative to the\n    current directory.  Values in |data| are build file contents.  For each\n    |data| value with a \"targets\" key, the value of the \"targets\" key is taken\n    as a list containing target dicts.  Each target's fully-qualified name is\n    constructed from the pathname of the build file (|data| key) and its\n    \"target_name\" property.  These fully-qualified names are used as the keys\n    in the returned dict.  These keys provide access to the target dicts,\n    the dicts in the \"targets\" lists.\n    \"\"\"\n","sourceCodeStart":1414,"sourceCodeEnd":1450,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/tools/gyp/pylib/gyp/input.py#L1414-L1450","documentation":"ProcessVariablesAndConditionsInList handles dict, list, str, and int items; any other item type (bool, float, None, tuple) reaches the final elif and raises this TypeError naming the class and the index. This is the list-context counterpart to error 495 and is raised when the item itself (before any expansion) is an unsupported type.","triggerScenarios":"A GYP list literal contains True/False/None/1.5 directly; a programmatic gyp caller appends a non-supported scalar to a list; a .gypi include emits a JSON null or boolean inside a list.","commonSituations":"Writing 'defines': [None] or 'sources': [True]; templating that drops a value leaving None; JSON merge introducing booleans.","solutions":["Replace the offending item with a string or int (use '1'/'0' for booleans, drop None items entirely).","Sanitize the list at the source (the .gypi include or programmatic caller).","Use the index in the message to locate the exact item quickly."],"exampleFix":"// before\n'defines': ['FOO', None, 'BAR'],\n// after\n'defines': ['FOO', 'BAR'],","handlingStrategy":"type-guard","validationCode":"for index, item in enumerate(the_list):\n    assert isinstance(item, (dict, list, str, int)) and not isinstance(item, bool), \\\n        f'List item at index {index} has unsupported type {type(item).__name__}'","typeGuard":"def is_supported_list_item(item) -> bool:\n    return isinstance(item, (dict, list, str, int)) and not isinstance(item, bool)","tryCatchPattern":null,"preventionTips":["Never put True/False/None/float directly in a GYP list literal.","Drop None items during list construction.","Validate .gypi includes the same way as .gyp files."],"tags":["gyp","type-check","list","syntax","build-config"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}