{"record":{"id":"c44a85786d553766","repo":"nodejs/node","slug":"converted-value-for-s-not-specified","errorCode":null,"errorMessage":"converted value for %s not specified.","messagePattern":"converted value for (.+?) not specified\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/gyp/pylib/gyp/MSVSSettings.py","lineNumber":215,"sourceCode":"\n    def ValidateMSVS(self, value):\n        # Try to convert.  It will raise an exception if not valid.\n        self.ConvertToMSBuild(value)\n\n    def ValidateMSBuild(self, value):\n        if value not in self._msbuild_values:\n            raise ValueError(\"unrecognized enumerated value %s\" % value)\n\n    def ConvertToMSBuild(self, value):\n        index = int(value)\n        if index < 0 or index >= len(self._label_list):\n            raise ValueError(\n                \"index value (%d) not in expected range [0, %d)\"\n                % (index, len(self._label_list))\n            )\n        label = self._label_list[index]\n        if label is None:\n            raise ValueError(\"converted value for %s not specified.\" % value)\n        return label\n\n\n# Instantiate the various generic types.\n_boolean = _Boolean()\n_integer = _Integer()\n# For now, we don't do any special validation on these types:\n_string = _String()\n_file_name = _String()\n_folder_name = _String()\n_file_list = _StringList()\n_folder_list = _StringList()\n_string_list = _StringList()\n# Some boolean settings went from numerical values to boolean.  The\n# mapping is 0: default, 1: false, 2: true.\n_newly_boolean = _Enumeration([\"\", \"false\", \"true\"])\n\n","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/tools/gyp/pylib/gyp/MSVSSettings.py#L197-L233","documentation":"_Enumeration.ConvertToMSBuild raises ValueError('converted value for %s not specified.') when the MSVS integer index is in range but maps to a None entry in _label_list. Enumerations use None placeholders for MSVS values that have no MSBuild equivalent (deprecated options). So the index is valid on the MSVS side but cannot be translated to MSBuild.","triggerScenarios":"Using a deprecated/removed MSVS compiler option (e.g. an old /O style) whose slot is None in the label list, then converting to MSBuild; an enumeration built with explicit None entries for legacy values.","commonSituations":"Upgrading a project from VCExpress/VS2005 era settings that no longer exist in modern MSBuild; preserving an old .gyp whose enumeration placeholders have since been nulled.","solutions":["Find the _Enumeration definition and pick an index whose label is not None.","Migrate the deprecated option to its modern MSBuild equivalent (consult MSVSSettings conversion table).","Drop the setting on the MSBuild side and set it only in msvs_settings if MSVS-only output is needed."],"exampleFix":"# before: index maps to None placeholder (deprecated option)\n'Optimization': '1',  # label is None in this enumeration\n\n# after: choose an index with a real MSBuild label\n'Optimization': '2',","handlingStrategy":"validation","validationCode":"def has_msbuild_label(enum_type, index):\n    i = int(index)\n    return 0 <= i < len(enum_type._label_list) and enum_type._label_list[i] is not None","typeGuard":"def index_translates_to_msbuild(enum_type, value) -> bool:\n    try:\n        return enum_type._label_list[int(value)] is not None\n    except (IndexError, ValueError, TypeError):\n        return False","tryCatchPattern":"try:\n    enum_type.ConvertToMSBuild(my_value)\nexcept ValueError as e:\n    if 'not specified' in str(e):\n        # deprecated option with no MSBuild equivalent -> drop or remap\n        my_value = None  # caller omits the setting","preventionTips":["Avoid MSVS enumeration entries whose label is None (deprecated options).","When upgrading VS versions, audit for newly-deprecated options and remap them.","Keep a mapping table from legacy options to their modern MSBuild equivalents."],"tags":["gyp","msvs","msbuild","enumeration","deprecation","migration"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}