{"record":{"id":"db9927f76fbb0ea0","repo":"dagger/dagger","slug":"failed-to-update-tsconfig-paths-s-w","errorCode":null,"errorMessage":"failed to update tsconfig paths %s: %w","messagePattern":"failed to update tsconfig paths (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdk/typescript/runtime/tsutils/tsconfig_updator.go","lineNumber":42,"sourceCode":"func UpdateTSConfigForModule(tsConfig string) (string, error) {\n\ttsConfig = removeJSONComments(tsConfig)\n\n\t// Add path.\"@dagger.io/dagger\"=[\"./sdk/index.ts\"]\n\ttsConfig, err := sjson.Set(tsConfig,\n\t\t\"compilerOptions.paths.\"+gjson.Escape(daggerLibPathAlias),\n\t\t[]string{daggerLibPath},\n\t)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to update tsconfig paths: %w\", err)\n\t}\n\n\t// Add path.\"@dagger.io/dagger/telemetry\"=[\"./sdk/telemetry.ts\"]\n\ttsConfig, err = sjson.Set(tsConfig,\n\t\t\"compilerOptions.paths.\"+gjson.Escape(daggerTelemetryPathAlias),\n\t\t[]string{daggerTelemetryLibPath},\n\t)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to update tsconfig paths %s: %w\", daggerTelemetryPathAlias, err)\n\t}\n\n\t// Add compilerOptions.experimentalDecorators=true\n\ttsConfig, err = sjson.Set(tsConfig, \"compilerOptions.experimentalDecorators\", true)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to update tsconfig experimentalDecorators: %w\", err)\n\t}\n\n\treturn tsConfig, nil\n}\n\nfunc UpdateTSConfigForClient(tsConfig string, isRemote bool) (string, error) {\n\ttsConfig = removeJSONComments(tsConfig)\n\n\t// If the dagger library is remote, we don't need to override @dagger.io/dagger\n\t// and @dagger.io/dagger/telemetry\n\tif isRemote {\n\t\treturn tsConfig, nil","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/sdk/typescript/runtime/tsutils/tsconfig_updator.go#L24-L60","documentation":"Same family as the other tsconfig update errors, but this one is specific to setting the `@dagger.io/dagger/telemetry` path alias in a module tsconfig, with the alias name interpolated into the message for diagnosis. It indicates sjson could not apply the telemetry alias mapping, almost always because the surrounding tsconfig JSON is malformed or the paths value is not an object.","triggerScenarios":"sjson.Set on `compilerOptions.paths.@dagger.io/dagger/telemetry` fails because the tsconfig string is invalid JSON or `paths` holds a scalar/array instead of an object.","commonSituations":"Telemetry alias added in newer SDK versions colliding with an older hand-written tsconfig where paths was redefined; JSONC syntax not accepted; truncated file from a failed write.","solutions":["Repair tsconfig.json to valid JSON with paths as an object","Regenerate via `dagger develop`","Ensure no duplicate/overriding `paths` key appears later in compilerOptions","If using JSONC features, keep codegen-managed keys minimal or let Dagger own the file"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const cfg = JSON.parse(fs.readFileSync('tsconfig.json', 'utf8'));\nif (typeof cfg.compilerOptions?.paths !== 'object' || cfg.compilerOptions.paths === null) {\n  cfg.compilerOptions = cfg.compilerOptions || {};\n  cfg.compilerOptions.paths = {};\n}\nfs.writeFileSync('tsconfig.json', JSON.stringify(cfg, null, 2));","typeGuard":null,"tryCatchPattern":"try {\n  const tsconfig = await createOrUpdateTSConfigForModule(...)\n} catch (e) {\n  if (String(e).includes('@dagger.io/dagger/telemetry')) {\n    // tsconfig JSON is invalid; repair and retry\n  }\n  throw e;\n}","preventionTips":["Ensure paths is an object so the telemetry alias can be added","Avoid JSONC syntax in codegen-managed tsconfigs","Regenerate tsconfig after SDK version upgrades","Check for duplicate compilerOptions keys in tsconfig"],"tags":["typescript","tsconfig","telemetry","json-mutation"],"backgroundTag":"tsconfig-paths-error","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"}