BloopAI/vibe-kanban · warning

PostHog API key or endpoint not set. Analytics will be disab

Error message

PostHog API key or endpoint not set. Analytics will be disabled.

What it means

At bootstrap, the local web app initializes PostHog analytics only when both `VITE_POSTHOG_API_KEY` and `VITE_POSTHOG_API_ENDPOINT` are set in the Vite environment. When either is missing, it skips posthog.init and logs this console.warn; the app continues running with analytics disabled.

Source

Thrown at packages/local-web/src/app/entry/Bootstrap.tsx:43

    integrations: [Sentry.tanstackRouterBrowserTracingIntegration(router)],
  });
  Sentry.setTag('source', 'frontend');
}

if (
  import.meta.env.VITE_POSTHOG_API_KEY &&
  import.meta.env.VITE_POSTHOG_API_ENDPOINT
) {
  posthog.init(import.meta.env.VITE_POSTHOG_API_KEY, {
    api_host: import.meta.env.VITE_POSTHOG_API_ENDPOINT,
    capture_pageview: false,
    capture_pageleave: true,
    capture_performance: true,
    autocapture: false,
    opt_out_capturing_by_default: true,
  });
} else {
  console.warn(
    'PostHog API key or endpoint not set. Analytics will be disabled.'
  );
}

// In the Tauri desktop app, implement custom zoom (Cmd/Ctrl + =/–/0) via root
// font-size scaling and block trackpad/touchpad pinch-to-zoom.
if (isTauriApp()) {
  initZoom();

  document.addEventListener('keydown', (e) => {
    const mod = e.metaKey || e.ctrlKey;
    if (!mod) return;

    if (e.key === '=' || e.key === '+') {
      e.preventDefault();
      zoomIn();
    } else if (e.key === '-') {
      e.preventDefault();

View on GitHub (pinned to 4deb7eca8f)

Solutions

  1. Set both VITE_POSTHOG_API_KEY and VITE_POSTHOG_API_ENDPOINT in your `.env` (or shell) and restart the dev server.
  2. If analytics are intentionally unwanted, ignore the warning or silence it — the app functions normally.
  3. Check for typos in variable names and confirm the `.env` file is in `packages/local-web/` or the workspace root that Vite loads.

Example fix

// .env before
# (no posthog vars)

// .env after
VITE_POSTHOG_API_KEY=phc_xxxxxxxxxxxx
VITE_POSTHOG_API_ENDPOINT=https://us.i.posthog.com
Defensive patterns

Strategy: validation

Validate before calling

const missing = [
  !import.meta.env.VITE_POSTHOG_API_KEY && 'VITE_POSTHOG_API_KEY',
  !import.meta.env.VITE_POSTHOG_API_ENDPOINT && 'VITE_POSTHOG_API_ENDPOINT',
].filter(Boolean);
if (missing.length) console.warn(`Analytics disabled: missing env vars: ${missing.join(', ')}`);

Prevention

When it happens

Trigger: Building or running `pnpm run local-web:dev` without VITE_POSTHOG_API_KEY or VITE_POSTHOG_API_ENDPOINT defined in `.env` / shell env; variables defined under a different prefix; using a `.env.local` not picked up; prod build from a machine without the env file.

Common situations: Fresh clone without copying `.env.example` to `.env`; self-hosted/local dev where telemetry is intentionally unset; CI builds lacking secret env vars; Vite server restarted before adding env vars (requires restart to pick them up).

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of BloopAI/vibe-kanban@4deb7eca8f (2026-08-29). Data as JSON: /api/errors/dec58964c64d0a21. Report an issue: GitHub.