{"record":{"id":"38e6adc394c6ee2b","repo":"dagger/dagger","slug":"failed-to-update-tsconfig-json-w","errorCode":null,"errorMessage":"failed to update tsconfig.json: %w","messagePattern":"failed to update tsconfig\\.json: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdk/typescript/runtime/config_updator.go","lineNumber":34,"sourceCode":"\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to lookup for tsconfig.json: %w\", err)\n\t}\n\n\t// If no tsconfig.json is found in the user module, we generate a default one.\n\tif !tsconfigExist {\n\t\tdefaultTSConfigContent := tsutils.DefaultTSConfig()\n\n\t\treturn dag.File(\"tsconfig.json\", defaultTSConfigContent).Sync(ctx)\n\t}\n\n\ttsConfigContent, err := modSourceDir.File(\"tsconfig.json\").Contents(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to read module's tsconfig.json: %w\", err)\n\t}\n\n\tupdatedTSConfigContent, err := tsutils.UpdateTSConfigForModule(tsConfigContent)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to update tsconfig.json: %w\", err)\n\t}\n\n\treturn dag.File(\"tsconfig.json\", updatedTSConfigContent).Sync(ctx)\n}\n\nfunc CreateOrUpdateTSConfigForClient(ctx context.Context, modSourceDir *dagger.Directory, isRemote bool) (*dagger.File, error) {\n\ttsConfigExist, err := modSourceDir.Exists(ctx, \"tsconfig.json\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to lookup for tsconfig.json: %w\", err)\n\t}\n\n\tif !tsConfigExist {\n\t\tdefaultTSConfigContent := tsutils.DefaultTSConfig()\n\t\treturn dag.File(\"tsconfig.json\", defaultTSConfigContent).Sync(ctx)\n\t}\n\n\ttsConfigContent, err := modSourceDir.File(\"tsconfig.json\").Contents(ctx)\n\tif err != nil {","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/sdk/typescript/runtime/config_updator.go#L16-L52","documentation":"This error is returned by CreateOrUpdateTSConfigForModule when tsutils.UpdateTSConfigForModule cannot merge Dagger's required compilerOptions/paths into the module's existing tsconfig.json. It wraps the underlying cause (almost always invalid JSON in tsconfig.json) so the engine's output names the failing step. It only fires when a tsconfig.json already exists in the module source; a missing file would trigger the default-config path instead.","triggerScenarios":"Running `dagger develop`/`dagger call` on a TypeScript module whose committed tsconfig.json exists but fails UpdateTSConfigForModule — typically because the file contains invalid JSON (comments, trailing commas, BOM) or is malformed such that the updater cannot parse/merge it.","commonSituations":"A developer hand-edited tsconfig.json and left a trailing comma or comment (jsonc content in a file parsed as strict JSON); the file was truncated by a bad merge; an encoding issue (UTF-16/BOM) from a Windows editor; or an old tsconfig format that the updater no longer understands.","solutions":["Validate your tsconfig.json with a strict JSON parser (e.g. `jq . tsconfig.json`) and fix any syntax errors such as trailing commas or comments.","If the file uses jsonc-style comments, move them out or re-encode the file as plain UTF-8 (no BOM) JSON.","Temporarily delete tsconfig.json and re-run so Dagger generates a known-good default, then re-apply your custom settings on top.","Inspect the wrapped `%w` cause in the full error chain to identify the exact parse failure and file region."],"exampleFix":"// before (tsconfig.json with trailing comma)\n{\n  \"compilerOptions\": {\n    \"strict\": true,\n  }\n}\n\n// after\n{\n  \"compilerOptions\": {\n    \"strict\": true\n  }\n}","handlingStrategy":"validation","validationCode":"// run before dagger develop\njq empty tsconfig.json && echo ok || echo 'tsconfig.json is not valid strict JSON'","typeGuard":null,"tryCatchPattern":"// bash wrapper\nif ! dagger develop; then\n  jq empty tsconfig.json || (rm tsconfig.json && dagger develop)  # regenerate default\nfi","preventionTips":["Keep tsconfig.json as strict JSON: no comments, no trailing commas, no BOM.","Validate tsconfig.json in pre-commit hooks with jq or a JSON linter.","Let Dagger generate the default tsconfig and apply custom settings on top."],"tags":["typescript","tsconfig","config","json-parse"],"backgroundTag":"tsconfig-update-failed","analyzedSha":"82ba2681dbe30d3547a1dc50ea495900ab5b6047","analyzedAt":"2026-09-05T07:21:37.930Z","contentChangedAt":"2026-09-05T07:21:37.930Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}