Title: tsc panics when a content mapper reports an option diagnostic for a `contentMappers` entry inherited through `extends` · Issue #65651 · microsoft/TypeScript · GitHub
Open Graph Title: tsc panics when a content mapper reports an option diagnostic for a `contentMappers` entry inherited through `extends` · Issue #65651 · microsoft/TypeScript
X Title: tsc panics when a content mapper reports an option diagnostic for a `contentMappers` entry inherited through `extends` · Issue #65651 · microsoft/TypeScript
Description: TypeScript Version The tested TypeScript version is 7.1.0-beta. It also reproduces with tsc built from main at 88071f4. User Goal The user is writing a content mapper. While testing it with the contentMappers entry in a base config that ...
Open Graph Description: TypeScript Version The tested TypeScript version is 7.1.0-beta. It also reproduces with tsc built from main at 88071f4. User Goal The user is writing a content mapper. While testing it with the con...
X Description: TypeScript Version The tested TypeScript version is 7.1.0-beta. It also reproduces with tsc built from main at 88071f4. User Goal The user is writing a content mapper. While testing it with the con...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/65651
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"tsc panics when a content mapper reports an option diagnostic for a `contentMappers` entry inherited through `extends`","articleBody":"## TypeScript Version\n\nThe tested TypeScript version is `7.1.0-beta`. It also reproduces with `tsc` built from `main` at 88071f4e84b1517c58429b4e10908275824c225c.\n\n## User Goal\n\nThe user is writing a content mapper. While testing it with the `contentMappers` entry in a base config that `tsconfig.json` extends, they saw `tsc` crash when the mapper reported an invalid option, and asked me to reduce the crash to a minimal reproduction and report it.\n\n## Setup and Action\n\nRun this script in an empty directory. The last line runs `tsc --runExternalCode` in `repro`.\n\n```sh\nmkdir -p repro/node_modules/fake-mapper && cd repro\n\ncat > tsconfig.base.json \u003c\u003c'EOF'\n{ \"contentMappers\": [{ \"package\": \"fake-mapper\", \"extensions\": [\".fake\"], \"options\": { \"a\": 1 } }] }\nEOF\n\ncat > tsconfig.json \u003c\u003c'EOF'\n{ \"extends\": \"./tsconfig.base.json\" }\nEOF\n\necho 'x' > data.fake\n\ncat > node_modules/fake-mapper/package.json \u003c\u003c'EOF'\n{ \"name\": \"fake-mapper\", \"version\": \"1.0.0\", \"typescript\": { \"contentMapper\": { \"exec\": [\"node\", \"server.mjs\"] } } }\nEOF\n\n# Answers every request; openProject reports one invalid option.\ncat > node_modules/fake-mapper/server.mjs \u003c\u003c'EOF'\nlet buffer = Buffer.alloc(0);\nprocess.stdin.on(\"data\", chunk => {\n buffer = Buffer.concat([buffer, chunk]);\n for (let end; (end = buffer.indexOf(\"\\r\\n\\r\\n\")) >= 0;) {\n const length = Number(/Content-Length: (\\d+)/i.exec(buffer.subarray(0, end))[1]);\n if (buffer.length \u003c end + 4 + length) return;\n const message = JSON.parse(buffer.subarray(end + 4, end + 4 + length));\n buffer = buffer.subarray(end + 4 + length);\n if (message.id === undefined) continue;\n const result = message.method === \"initialize\" ? { protocolVersion: message.params.protocolVersion, positionEncoding: \"utf-16\", diagnosticSource: \"fake\" }\n : message.method === \"openProject\" ? { optionDiagnostics: [{ path: [\"a\"], messageText: \"Option 'a' must be a string.\", code: 1 }] }\n : message.method === \"transform\" ? { extension: \".ts\", text: \"export {};\\n\", mappings: [] }\n : {};\n const body = JSON.stringify({ jsonrpc: \"2.0\", id: message.id, result });\n process.stdout.write(`Content-Length: ${Buffer.byteLength(body)}\\r\\n\\r\\n${body}`);\n }\n});\nEOF\n\nnpx -y -p typescript@7.1.0-beta tsc --runExternalCode\n```\n\n## Expected and Actual Behavior\n\n**What actually happened**: `tsc` panics:\n\n```\npanic: runtime error: invalid memory address or nil pointer dereference\n[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x102dbf164]\n\ngoroutine 1 [running]:\ngithub.com/microsoft/TypeScript/tsc/internal/ast.IsObjectLiteralExpression(...)\n\tgithub.com/microsoft/TypeScript/tsc/internal/ast/ast_generated.go:4808\ngithub.com/microsoft/TypeScript/tsc/internal/tsoptions.GetContentMapperOptionDiagnosticLocation(0x6c7a8eeb1520, 0x10301cc70?, {0x6c7a8ee7b9c0, 0x1, 0x6c7a9003ec90?})\n\tgithub.com/microsoft/TypeScript/tsc/internal/tsoptions/tsconfigparsing.go:1690 +0x174\ngithub.com/microsoft/TypeScript/tsc/internal/compiler.(*Program).collectContentMapperOptionDiagnostics.func1(...)\n\tgithub.com/microsoft/TypeScript/tsc/internal/compiler/program.go:864\ngithub.com/microsoft/TypeScript/tsc/internal/core.Map[...](...)\n\tgithub.com/microsoft/TypeScript/tsc/internal/core/core.go:86\ngithub.com/microsoft/TypeScript/tsc/internal/compiler.(*Program).collectContentMapperOptionDiagnostics(0x6c7a8ef92e08)\n\tgithub.com/microsoft/TypeScript/tsc/internal/compiler/program.go:863 +0x13c\ngithub.com/microsoft/TypeScript/tsc/internal/compiler.NewProgram({{0x6c7a8eeb1520, 0x0, 0x0, {0x0, 0x0}, {0x0, 0x0}, 0x0}, {{0x104072240, 0x6c7a8eee4730}, ...}, ...})\n\tgithub.com/microsoft/TypeScript/tsc/internal/compiler/program.go:326 +0x398\ngithub.com/microsoft/TypeScript/tsc/internal/execute.performCompilation({0x1040713c0?, 0x6c7a8ef5c880?}, {0x104072a00, 0x6c7a8ee80a20}, 0x6c7a8eeb1520, 0x6c7a8efb6440, 0x104074b10, {0x10406f280, 0x6c7a8eea1d40}, 0x6c7a8eee4500, ...)\n\tgithub.com/microsoft/TypeScript/tsc/internal/execute/tsc.go:382 +0x2b4\ngithub.com/microsoft/TypeScript/tsc/internal/execute.tscCompilation({0x1040713c0, 0x6c7a8ef5c880}, {0x104072a00, 0x6c7a8ee80a20}, 0x6c7a8eeb1380, {0x0, 0x0})\n\tgithub.com/microsoft/TypeScript/tsc/internal/execute/tsc.go:262 +0xaa4\ngithub.com/microsoft/TypeScript/tsc/internal/execute.CommandLine({0x1040713c0, 0x6c7a8ef5c880}, {0x104072a00, 0x6c7a8ee80a20}, {0x6c7a8eeae090, 0x1, 0x1}, {0x0, 0x0})\n\tgithub.com/microsoft/TypeScript/tsc/internal/execute/tsc.go:63 +0x1dc\nmain.runMain()\n\tgithub.com/microsoft/TypeScript/tsc/cmd/tsc/main.go:31 +0x1ac\nmain.main()\n\tgithub.com/microsoft/TypeScript/tsc/cmd/tsc/main.go:15 +0x1c\n```\n\n**What I expected**: The mapper's diagnostic, as `tsc` reports it when the same `contentMappers` entry is written in `tsconfig.json` itself (`cp tsconfig.base.json tsconfig.json`):\n\n```\ntsconfig.json(1,93): error fake1: Option 'a' must be a string.\n```\n\n## Agent Info\n\nClaude Code 2.1.331 + Claude Opus 5.5 + Skill Version 1.0\n","author":{"url":"https://github.com/benpsnyder","@type":"Person","name":"benpsnyder"},"datePublished":"2026-11-24T04:17:47Z","url":"https://github.com/microsoft/TypeScript/issues/65651"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:84d3be36-d786-7577-05f3-1d76e300a060 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DD64:0DF6:BFDC4E:F984CB:6B063F7C |
| html-safe-nonce | cabb0f3e3e6c2e2ed82b4d63df5716307fbd1e4f3a175b345c3db5d382a83898 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERDY0OjBERjY6QkZEQzRFOkY5ODRDQjo2QjA2M0Y3QyIsInZpc2l0b3JfaWQiOiIxODU5MTA5OTcyMDYwMDI4Nzk2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | ae4b6591e942442a094fd8011d54fc0221f407cb53a6f0de72ea8dface72d8a2 |
| hovercard-subject-tag | issue:6574507684 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/65651/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d35ec23f479ad9a308169677304cdcf907ab43db59b94bb2a9062606a9ec4e31/microsoft/TypeScript/issues/65651 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d35ec23f479ad9a308169677304cdcf907ab43db59b94bb2a9062606a9ec4e31/microsoft/TypeScript/issues/65651 |
| og:image:alt | TypeScript Version The tested TypeScript version is 7.1.0-beta. It also reproduces with tsc built from main at 88071f4. User Goal The user is writing a content mapper. While testing it with the con... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | benpsnyder |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1bff4f6bfaa96dc9c42cacf315424c24ebb548b06142ced5e3aaccb2a42dd652 |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ac613d3698d3d8565651455086e1f74da07bf277 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width