{"record":{"id":"aad2eecf61eadeed","repo":"vercel/turborepo","slug":"config-is-invalid","errorCode":null,"errorMessage":"Config is invalid.","messagePattern":"Config is invalid\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"packages/turbo-telemetry/src/config.ts","lineNumber":65,"sourceCode":"\n      return undefined;\n    }\n  }\n\n  static async fromDefaultConfig(): Promise<TelemetryConfig | undefined> {\n    try {\n      const configPath = await utils.defaultConfigPath();\n      return TelemetryConfig.fromConfigPath(configPath);\n    } catch (e) {\n      return undefined;\n    }\n  }\n\n  static validateConfig(config: unknown): Config {\n    try {\n      return ConfigSchema.parse(config);\n    } catch (e) {\n      throw new Error(\"Config is invalid.\");\n    }\n  }\n\n  static create({\n    configPath\n  }: {\n    configPath: string;\n  }): TelemetryConfig | undefined {\n    const RawTelemetryId = randomUUID();\n    const telemetrySalt = randomUUID();\n    const telemetryId = utils.oneWayHashWithSalt({\n      input: RawTelemetryId,\n      salt: telemetrySalt\n    });\n\n    const config = new TelemetryConfig({\n      configPath,\n      config: {","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/vercel/turborepo/blob/9f94a7d215b3881942527dd526afa3fc650869d5/packages/turbo-telemetry/src/config.ts#L47-L83","documentation":"TelemetryConfig.validateConfig() parses a telemetry config object with a zod schema that requires telemetry_enabled (boolean), telemetry_id (string), telemetry_salt (string), with optional telemetry_alerted (string). Any mismatch throws this generic message and discards the underlying ZodError. In the normal read path (fromConfigPath) the error is caught and the corrupt telemetry.json is deleted and regenerated, so it only escapes when validateConfig is called directly.","triggerScenarios":"Calling TelemetryConfig.validateConfig(rawConfig) with an object that fails ConfigSchema.parse: missing or misspelled keys (telemetryId instead of telemetry_id), wrong types (telemetry_enabled: \"true\" instead of true), or a hand-edited file that is valid JSON but not valid telemetry config.","commonSituations":"Hand-editing ~/.config/turborepo/telemetry.json to disable telemetry with a string value; another tool truncating or rewriting the file; direct API use of validateConfig without pre-validation.","solutions":["Delete the telemetry config file (e.g. ~/.config/turborepo/telemetry.json, or wherever TURBO_CONFIG_DIR_PATH points) — Turborepo recreates it on the next run","Fix the file to match the schema: { \"telemetry_enabled\": true, \"telemetry_id\": \"<uuid>\", \"telemetry_salt\": \"<uuid>\" } with booleans, not strings","If calling validateConfig yourself, parse with the same zod schema first so you see the real validation issues"],"exampleFix":"// before (invalid: string instead of boolean)\n{ \"telemetry_enabled\": \"false\", \"telemetry_id\": \"abc\" }\n\n// after\n{ \"telemetry_enabled\": false, \"telemetry_id\": \"abc\", \"telemetry_salt\": \"def\" }","handlingStrategy":"validation","validationCode":"import { z } from \"zod\";\n\nconst TelemetrySchema = z.object({\n  telemetry_enabled: z.boolean(),\n  telemetry_id: z.string(),\n  telemetry_salt: z.string(),\n  telemetry_alerted: z.string().optional()\n});\n\nconst parsed = TelemetrySchema.safeParse(rawConfig);\nif (!parsed.success) console.error(parsed.error.issues); // real reason\nelse TelemetryConfig.validateConfig(parsed.data);","typeGuard":"const isTelemetryConfig = (c: unknown): c is { telemetry_enabled: boolean; telemetry_id: string; telemetry_salt: string; telemetry_alerted?: string } =>\n  typeof c === \"object\" && c !== null &&\n  typeof (c as any).telemetry_enabled === \"boolean\" &&\n  typeof (c as any).telemetry_id === \"string\" &&\n  typeof (c as any).telemetry_salt === \"string\";","tryCatchPattern":"try {\n  TelemetryConfig.validateConfig(raw);\n} catch (e) {\n  if (e instanceof Error && e.message === \"Config is invalid.\") {\n    // recover: delete config file and let TelemetryConfig.create regenerate it\n  } else throw e;\n}","preventionTips":["Never hand-edit telemetry.json; use env vars (TURBO_TELEMETRY_DISABLED) to toggle telemetry","Keep booleans as booleans when scripting against the file","If reading the config programmatically, use TelemetryConfig.fromConfigPath which self-heals corrupt files"],"tags":["telemetry","zod","config","schema-validation"],"backgroundTag":"schema-validation-failed","analyzedSha":"9f94a7d215b3881942527dd526afa3fc650869d5","analyzedAt":"2026-08-16T19:47:29.531Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}