{"record":{"id":"a8a627e0e6ad48ab","repo":"google-gemini/gemini-cli","slug":"invalid-telemetry-configuration-err-message","errorCode":null,"errorMessage":"Invalid telemetry configuration: ${err.message}.","messagePattern":"Invalid telemetry configuration: (.+?)\\.","errorType":"exception","errorClass":"FatalConfigError","httpStatus":null,"severity":"error","filePath":"packages/cli/src/config/config.ts","lineNumber":774,"sourceCode":"\n  // Force approval mode to default if the folder is not trusted.\n  if (!trustedFolder && approvalMode !== ApprovalMode.DEFAULT) {\n    debugLogger.warn(\n      `Approval mode overridden to \"default\" because the current folder is not trusted.`,\n    );\n    approvalMode = ApprovalMode.DEFAULT;\n  }\n\n  let telemetrySettings;\n  try {\n    telemetrySettings = await resolveTelemetrySettings({\n      // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion\n      env: process.env as unknown as Record<string, string | undefined>,\n      settings: settings.telemetry,\n    });\n  } catch (err) {\n    if (err instanceof FatalConfigError) {\n      throw new FatalConfigError(\n        `Invalid telemetry configuration: ${err.message}.`,\n      );\n    }\n    throw err;\n  }\n\n  // -p/--prompt forces non-interactive (headless) mode\n  // -i/--prompt-interactive forces interactive mode with an initial prompt\n  const interactive =\n    !!argv.promptInteractive ||\n    !!argv.acp ||\n    !!argv.experimentalAcp ||\n    (!isHeadlessMode({ prompt: argv.prompt, query: argv.query }) &&\n      !argv.isCommand);\n\n  const allowedTools = argv.allowedTools || settings.tools?.allowed || [];\n\n  const isAcpMode = !!argv.acp || !!argv.experimentalAcp;","sourceCodeStart":756,"sourceCodeEnd":792,"githubUrl":"https://github.com/google-gemini/gemini-cli/blob/5024443c7217464a66e98f80d73172a26440bd8f/packages/cli/src/config/config.ts#L756-L792","documentation":"Wraps a `FatalConfigError` raised by `resolveTelemetrySettings` (called with `process.env` and `settings.telemetry`). It rethrows a new `FatalConfigError` with a `Invalid telemetry configuration:` prefix, preserving the inner message. The inner failure typically stems from an invalid endpoint URL, malformed sample rate, disabled-but-configured output, or an unrecognized exporter.","triggerScenarios":"Setting `telemetry.endpoint` to a non-URL string; an unrecognized `telemetry.exporter` value; a sample rate outside `[0,1]`; an env var like `OTEL_EXPORTER_OTLP_ENDPOINT` with an invalid protocol.","commonSituations":"Mistyped endpoint in settings.json; env var drift from another OTLP collector; CI environments that set `OTEL_*` vars globally; switching from a dev collector to a prod one with a typo.","solutions":["Read the inner message (everything after `Invalid telemetry configuration:`) for the specific failure.","Validate `telemetry.endpoint` is a full `http(s)://host[:port]` URL.","Confirm `telemetry.enabled` is consistent with the other fields (e.g. not disabled while endpoints are set).","Clear the offending `OTEL_*` env var to fall back to defaults."],"exampleFix":"// before (settings.json)\n{ \"telemetry\": { \"endpoint\": \"localhost:4317\" } }\n// after\n{ \"telemetry\": { \"endpoint\": \"http://localhost:4317\" } }","handlingStrategy":"try-catch","validationCode":"function isHttpUrl(v: unknown): v is string {\n  return typeof v === 'string' && /^https?:\\/\\/.+/.test(v);\n}\nif (settings.telemetry?.endpoint && !isHttpUrl(settings.telemetry.endpoint)) {\n  throw new Error('telemetry.endpoint must be a full http(s):// URL');\n}","typeGuard":"function isTelemetrySettings(v: unknown): boolean {\n  if (typeof v !== 'object' || v === null) return true;\n  const t = v as { endpoint?: unknown; sampleRate?: unknown };\n  if (t.endpoint !== undefined && !/^https?:\\/\\/.+/.test(String(t.endpoint))) return false;\n  if (t.sampleRate !== undefined && (typeof t.sampleRate !== 'number' || t.sampleRate < 0 || t.sampleRate > 1)) return false;\n  return true;\n}","tryCatchPattern":"try {\n  telemetrySettings = await resolveTelemetrySettings({ env, settings: settings.telemetry });\n} catch (err) {\n  if (err instanceof FatalConfigError) {\n    throw new FatalConfigError(`Invalid telemetry configuration: ${err.message}.`);\n  }\n  throw err;\n}","preventionTips":["Always include the scheme in `telemetry.endpoint`.","Keep `sampleRate` within `[0, 1]`.","Audit `OTEL_*` env vars in CI before running Gemini."],"tags":["cli","telemetry","config","validation"],"backgroundTag":null,"analyzedSha":"5024443c7217464a66e98f80d73172a26440bd8f","analyzedAt":"2026-08-12T06:01:53.711Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}