{"record":{"id":"97bd38440def3d3d","repo":"microsoft/TypeScript","slug":"cannot-create-a-case-insensitive-file-system-from","errorCode":null,"errorMessage":"Cannot create a case-insensitive file system from a case-sensitive one.","messagePattern":"Cannot create a case-insensitive file system from a case-sensitive one\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/harness/vfsUtil.ts","lineNumber":163,"sourceCode":"        const fs = new FileSystem(this.ignoreCase, { time: this._time });\r\n        fs._lazy = this._lazy;\r\n        fs._cwd = this._cwd;\r\n        fs._time = this._time;\r\n        fs._shadowRoot = this._shadowRoot;\r\n        fs._dirStack = this._dirStack;\r\n        fs.makeReadonly();\r\n        this._lazy = {};\r\n        this._shadowRoot = fs;\r\n    }\r\n\r\n    /**\r\n     * Gets a shadow copy of this file system. Changes to the shadow copy do not affect the\r\n     * original, allowing multiple copies of the same core file system without multiple copies\r\n     * of the same data.\r\n     */\r\n    public shadow(ignoreCase: boolean = this.ignoreCase): FileSystem {\r\n        if (!this.isReadonly) throw new Error(\"Cannot shadow a mutable file system.\");\r\n        if (ignoreCase && !this.ignoreCase) throw new Error(\"Cannot create a case-insensitive file system from a case-sensitive one.\");\r\n        const fs = new FileSystem(ignoreCase, { time: this._time });\r\n        fs._shadowRoot = this;\r\n        fs._cwd = this._cwd;\r\n        return fs;\r\n    }\r\n\r\n    /**\r\n     * Gets or sets the timestamp (in milliseconds) used for file status, returning the previous timestamp.\r\n     *\r\n     * @link http://pubs.opengroup.org/onlinepubs/9699919799/functions/time.html\r\n     */\r\n    public time(value?: number): number {\r\n        if (value !== undefined) {\r\n            if (this.isReadonly) throw createIOError(\"EPERM\");\r\n            this._time = value;\r\n        }\r\n        else if (!this.isReadonly) {\r\n            this._time += timeIncrements;\r","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/microsoft/TypeScript/blob/b465fdbfe175304d9b977da137b2c178ae1091d3/src/harness/vfsUtil.ts#L145-L181","documentation":"Thrown by FileSystem.shadow (vfsUtil.ts:163) when the caller requests `ignoreCase: true` (case-insensitive) on a source file system that is case-sensitive (ignoreCase === false). A case-insensitive overlay cannot be layered on top of case-sensitive data because name lookups would not match the underlying nodes.","triggerScenarios":"`fs.shadow(true)` is invoked on an FS constructed with `ignoreCase: false`. The default argument to shadow is `this.ignoreCase`, so this only fires when the caller explicitly passes true.","commonSituations":"Trying to simulate Windows/macOS behaviour by shadowing a Linux-style case-sensitive base; reusing a case-sensitive fixture for a case-insensitive test; passing a hard-coded `true` for ignoreCase regardless of the source.","solutions":["Construct the base FileSystem with `ignoreCase: true` from the start, then shadow with the default argument.","If the base must remain case-sensitive, do not request a case-insensitive shadow — keep ignoreCase false or build a fresh FS.","Pass `fs.shadow(fs.ignoreCase)` explicitly to inherit rather than forcing true."],"exampleFix":"// before\nconst base = new FileSystem(false /*case-sensitive*/, {...});\nbase.makeReadonly();\nconst fork = base.shadow(true); // throws\n\n// after — build case-insensitive from the source\nconst base = new FileSystem(true /*case-insensitive*/, {...});\nbase.makeReadonly();\nconst fork = base.shadow();","handlingStrategy":"validation","validationCode":"// Only request a case-insensitive shadow if the source already is.\nconst fork = fs.shadow(fs.ignoreCase); // inherit instead of forcing true","typeGuard":"function canShadowAsCaseInsensitive(fs: FileSystem): boolean {\n  return fs.ignoreCase === true;\n}","tryCatchPattern":null,"preventionTips":["Construct the base FS with the desired case sensitivity up front.","Pass `fs.ignoreCase` to shadow rather than a hard-coded true.","Keep one fixture per case-sensitivity scenario."],"tags":["test-harness","vfs","case-sensitivity","filesystem"],"backgroundTag":null,"analyzedSha":"b465fdbfe175304d9b977da137b2c178ae1091d3","analyzedAt":"2026-08-12T05:38:42.698Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}