TalosError: Missing required environment variable MOZILLA_OFFICIAL when running integration tests
0 reputation · 01 Aug 2026, 11:17 UTC
0 reputation · 01 Aug 2026, 11:17 UTC
When running Talos integration tests without production credentials, the goal is to execute the test suite locally while avoiding any dependence on external API keys for result upload.
The harness currently requires the MOZILLA_OFFICIAL environment variable; if it is unset, Talos fails with the error TalosError: Missing required environment variable MOZILLA_OFFICIAL and stops execution.
If MOZILLA_OFFICIAL is set but MOZ_API_KEY is missing, Talos logs a warning WARNING: No MOZ_API_KEY set; results will not be uploaded. and continues the test run.
A TODO comment in the source indicates uncertainty about whether the harness should automatically generate a temporary API key for local executions, leading to inconsistent behavior across branches.
Should Talos auto‑generate a temporary API key for local runs? If so, how should the key be scoped, stored, and cleaned up after the test? What impact would this have on result verification and downstream processes that expect uploaded data?
34775 reputation · 01 Aug 2026, 11:48 UTC
No — Talos should not auto-generate a temporary API key for local runs. For your immediate goal (run the suite locally with no external credentials), set MOZILLA_OFFICIAL for the test invocation only and leave MOZ_API_KEY unset. Talos will print WARNING: No MOZ_API_KEY set; results will not be uploaded. and continue, which is exactly the behavior you want.
Scope the variable to the single command rather than exporting it globally, because MOZILLA_OFFICIAL is a build/harness flag used across Mozilla tooling and can change behavior outside Talos:
MOZILLA_OFFICIAL=1 ./mach talos-test --suite <your-suite>
# or, for direct invocation:
MOZILLA_OFFICIAL=1 python talos/run_tests.py <config>Verify the run completes, that only the no-upload warning appears, and that local result files (JSON output) are written. Also confirm nothing from the run shows up in the production performance dashboard — that proves upload was genuinely skipped.
Confirmed from your description: the harness hard-fails when MOZILLA_OFFICIAL is unset, but only warns when MOZ_API_KEY is missing. The likely explanation — not confirmed without reading your tree — is that the MOZILLA_OFFICIAL check runs before the upload path is gated, so an unset flag aborts execution even though the upload it guards would have been skipped anyway. That ordering is arguably a harness bug, which matches the TODO comment you found. Exact behavior varies by Talos version and by whether you invoke via mach, mozharness, or directly, so check the source in your checkout to see where the variable is read and whether a --no-upload or local-results option already exists.
If ephemeral keys were ever implemented despite this, they would need to be scoped to a single run and a non-production results bucket, held only in process memory or a temp file with restrictive permissions, and revoked in a finally-style cleanup hook. That is a lot of machinery to solve a problem that doesn't exist.
An explicit local mode — a --no-upload flag, or treating MOZILLA_OFFICIAL=0 as "skip the credential requirement and the upload entirely" — removes the inconsistency across branches without inventing credentials. Results go only to local files, the TODO resolves itself, and downstream processes are unaffected because nothing is uploaded. If you can share the Talos version and how you invoke it (mach vs. direct), the recommendation on whether to patch the gate or just set the variable can be made more specific.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.