{"record":{"id":"c43dc81676d85087","repo":"microsoft/TypeScript","slug":"unknown-value-value-for-compiler-option-na","errorCode":null,"errorMessage":"Unknown value '${value}' for compiler option '${name}'.","messagePattern":"Unknown value '(.+?)' for compiler option '(.+?)'\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/harness/harnessIO.ts","lineNumber":294,"sourceCode":"        return optionsIndex.get(name.toLowerCase());\r\n    }\r\n\r\n    export function setCompilerOptionsFromHarnessSetting(settings: TestCaseParser.CompilerSettings, options: ts.CompilerOptions & HarnessOptions): void {\r\n        for (const name in settings) {\r\n            if (ts.hasProperty(settings, name)) {\r\n                const value = settings[name];\r\n                if (value === undefined) {\r\n                    throw new Error(`Cannot have undefined value for compiler option '${name}'.`);\r\n                }\r\n                if (name === \"typeScriptVersion\") {\r\n                    continue;\r\n                }\r\n                const option = getCommandLineOption(name);\r\n                if (option) {\r\n                    const errors: ts.Diagnostic[] = [];\r\n                    options[option.name] = optionValue(option, value, errors);\r\n                    if (errors.length > 0) {\r\n                        throw new Error(`Unknown value '${value}' for compiler option '${name}'.`);\r\n                    }\r\n                }\r\n                else {\r\n                    throw new Error(`Unknown compiler option '${name}'.`);\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    function optionValue(option: ts.CommandLineOption, value: string, errors: ts.Diagnostic[]): any {\r\n        switch (option.type) {\r\n            case \"boolean\":\r\n                return value.toLowerCase() === \"true\";\r\n            case \"string\":\r\n                return value;\r\n            case \"number\": {\r\n                const numverValue = parseInt(value, 10);\r\n                if (isNaN(numverValue)) {\r","sourceCodeStart":276,"sourceCodeEnd":312,"githubUrl":"https://github.com/microsoft/TypeScript/blob/b465fdbfe175304d9b977da137b2c178ae1091d3/src/harness/harnessIO.ts#L276-L312","documentation":"Thrown by setCompilerOptionsFromHarnessSetting when optionValue reports errors while parsing a known compiler option's value — i.e. the option name is recognised but the supplied string value cannot be coerced to the option's declared type (e.g. an invalid enum map entry or malformed list). The errors array from parsing is non-empty.","triggerScenarios":"A test setting supplies a value that fails the option's parse rules: an unrecognised value for a map-type option (e.g. an invalid 'target' or 'module' name), a malformed list element, or a custom-type parse failure.","commonSituations":"Typo in an enum-like value (e.g. module: 'comonjs'), an invalid list member, or using a value valid in a newer/older TypeScript version than the harness option set supports.","solutions":["Check the option's allowed values in optionDeclarations / commandLineOptions and supply a valid one.","Correct the typo or malformed element identified by the value in the message.","If the value is version-specific, confirm the harness TypeScript revision supports it."],"exampleFix":"// before\n// @module: comonjs\n// after\n// @module: commonjs","handlingStrategy":"validation","validationCode":"// Cross-check map-type option values against allowed entries before setting\nfunction validateMapOption(name: string, value: string, allowed: readonly string[]) {\n    if (!allowed.includes(value)) {\n        throw new Error(`'${value}' is not valid for '${name}'. Allowed: ${allowed.join(\", \")}`);\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep a reference of valid enum/map values for options like target, module, jsx.","Add a config-validation step to test setup that catches invalid values early."],"tags":["harness","compiler-options","configuration","invalid-value"],"backgroundTag":null,"analyzedSha":"b465fdbfe175304d9b977da137b2c178ae1091d3","analyzedAt":"2026-08-12T05:38:42.698Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}