{"record":{"id":"3e4be82d5a811e1d","repo":"affaan-m/ECC","slug":"live-transport-requires-taste-forge-allow-live-1-falapi","errorCode":null,"errorMessage":"live transport requires TASTE_FORGE_ALLOW_LIVE=1","messagePattern":"live transport requires TASTE_FORGE_ALLOW_LIVE=1","errorType":"exception","errorClass":"FalError","httpStatus":null,"severity":"error","filePath":"skills/taste-application/scripts/taste/falapi.py","lineNumber":182,"sourceCode":"\ndef is_dry_run() -> bool:\n    \"\"\"True when ``TASTE_FORGE_DRY_RUN`` is set to a truthy value.\n\n    Read live rather than snapshotted at import so a CLI's ``--dry-run`` flag\n    can enable it after this module is already imported.\n    \"\"\"\n    return os.environ.get(DRY_RUN_ENV, \"\").strip().lower() in {\"1\", \"true\", \"yes\", \"on\"}\n\n\ndef enable_dry_run() -> None:\n    \"\"\"Turn on dry-run mode for this process (what ``--dry-run`` calls).\"\"\"\n    os.environ[DRY_RUN_ENV] = \"1\"\n\n\ndef require_live() -> None:\n    \"\"\"Require explicit process-level authorization before any live transport.\"\"\"\n    if os.environ.get(\"TASTE_FORGE_ALLOW_LIVE\") != \"1\":\n        raise FalError(\"live transport requires TASTE_FORGE_ALLOW_LIVE=1\")\n\n\ndef safe_url(url: str) -> str:\n    \"\"\"Log only origin: paths, queries and userinfo can carry signed secrets.\"\"\"\n    try:\n        parsed = urllib.parse.urlsplit(url)\n        return f\"{parsed.scheme}://{parsed.hostname or '[invalid-host]'}\"\n    except ValueError:\n        return \"[invalid-url]\"\n\n\ndef api_key() -> str:\n    \"\"\"Return ``FAL_KEY`` after live opt-in. Never logs the value.\"\"\"\n    require_live()\n    key = os.environ.get(\"FAL_KEY\", \"\").strip()\n    if not key:\n        raise MissingKeyError(\n            \"FAL_KEY is not set.\\n\"","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/taste-application/scripts/taste/falapi.py#L164-L200","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Export TASTE_FORGE_ALLOW_LIVE=1 before running the script (exact value \"1\", not \"true\")","Set it inline: TASTE_FORGE_ALLOW_LIVE=1 python script.py","In CI, add TASTE_FORGE_ALLOW_LIVE=1 to the job's environment/secrets configuration","If you intended dry-run behavior, remove the live call instead — the gate is doing its job"],"exampleFix":"// before\npython make_video.py            # FalError: live transport requires...\n// after\nTASTE_FORGE_ALLOW_LIVE=1 python make_video.py","handlingStrategy":"validation","validationCode":"import os\nassert os.environ.get(\"TASTE_FORGE_ALLOW_LIVE\") == \"1\", \"set TASTE_FORGE_ALLOW_LIVE=1 to enable live calls\"","typeGuard":null,"tryCatchPattern":"try:\n    api.submit(...)\nexcept FalError as e:\n    if \"TASTE_FORGE_ALLOW_LIVE\" in str(e):\n        print(\"run with: TASTE_FORGE_ALLOW_LIVE=1 <command>\")\n    raise","preventionTips":["Set TASTE_FORGE_ALLOW_LIVE=1 exactly — 'true' or 'yes' will not pass the ==\"1\" check","Set it in CI/job env config, not ad-hoc shells, so it propagates reliably","Keep live mode off by default in shared scripts and enable per-invocation","Check os.environ early in your script entrypoint to fail fast with a clear message"],"tags":["environment-variable","safety-gate","configuration","live-api"],"backgroundTag":"missing-env-var","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}