affaan-m/ECC · error · FalError

live transport requires TASTE_FORGE_ALLOW_LIVE=1

Error message

live transport requires TASTE_FORGE_ALLOW_LIVE=1

What it means

require_live() raises FalError unless the process-level environment variable TASTE_FORGE_ALLOW_LIVE is set to exactly "1". It is a deliberate safety gate called before any live network transport (api_key, submit, upload, download), ensuring the library never hits the real fal.ai API by accident. The dry-run default keeps all operations local/offline.

Solutions

  1. Export TASTE_FORGE_ALLOW_LIVE=1 before running the script (exact value "1", not "true")
  2. Set it inline: TASTE_FORGE_ALLOW_LIVE=1 python script.py
  3. In CI, add TASTE_FORGE_ALLOW_LIVE=1 to the job's environment/secrets configuration
  4. If you intended dry-run behavior, remove the live call instead — the gate is doing its job

Example fix

// before
python make_video.py            # FalError: live transport requires...
// after
TASTE_FORGE_ALLOW_LIVE=1 python make_video.py
Defensive patterns

Strategy: validation

Validate before calling

import os
assert os.environ.get("TASTE_FORGE_ALLOW_LIVE") == "1", "set TASTE_FORGE_ALLOW_LIVE=1 to enable live calls"

Try / catch

try:
    api.submit(...)
except FalError as e:
    if "TASTE_FORGE_ALLOW_LIVE" in str(e):
        print("run with: TASTE_FORGE_ALLOW_LIVE=1 <command>")
    raise

Prevention

When it happens

Trigger: Calling api_key(), submit(), upload(), or download() without TASTE_FORGE_ALLOW_LIVE=1 in the environment — including when the variable is unset, set to "true"/"yes", or set to 0.

Common situations: Running a script that worked in dry-run against the live API for the first time; setting the env var in a shell that didn't propagate (CI secrets, IDE run configs); exporting TASTE_FORGE_ALLOW_LIVE=true which fails the strict =="1" check.

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 affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/3e4be82d5a811e1d. Report an issue: GitHub.

Appendix: source

Thrown at skills/taste-application/scripts/taste/falapi.py:182

def is_dry_run() -> bool:
    """True when ``TASTE_FORGE_DRY_RUN`` is set to a truthy value.

    Read live rather than snapshotted at import so a CLI's ``--dry-run`` flag
    can enable it after this module is already imported.
    """
    return os.environ.get(DRY_RUN_ENV, "").strip().lower() in {"1", "true", "yes", "on"}


def enable_dry_run() -> None:
    """Turn on dry-run mode for this process (what ``--dry-run`` calls)."""
    os.environ[DRY_RUN_ENV] = "1"


def require_live() -> None:
    """Require explicit process-level authorization before any live transport."""
    if os.environ.get("TASTE_FORGE_ALLOW_LIVE") != "1":
        raise FalError("live transport requires TASTE_FORGE_ALLOW_LIVE=1")


def safe_url(url: str) -> str:
    """Log only origin: paths, queries and userinfo can carry signed secrets."""
    try:
        parsed = urllib.parse.urlsplit(url)
        return f"{parsed.scheme}://{parsed.hostname or '[invalid-host]'}"
    except ValueError:
        return "[invalid-url]"


def api_key() -> str:
    """Return ``FAL_KEY`` after live opt-in. Never logs the value."""
    require_live()
    key = os.environ.get("FAL_KEY", "").strip()
    if not key:
        raise MissingKeyError(
            "FAL_KEY is not set.\n"

View on GitHub (pinned to 8321021c54)