{"record":{"id":"3454191484b1fe81","repo":"affaan-m/ECC","slug":"fal-call-failed-after-one-attempt-job-acceptance-may-be-345419","errorCode":null,"errorMessage":"fal call failed after one attempt; job acceptance may be unknown. Reconcile provider job status before requesting another generation.","messagePattern":"fal call failed after one attempt; job acceptance may be unknown\\. Reconcile provider job status before requesting another generation\\.","errorType":"exception","errorClass":"FalError","httpStatus":null,"severity":"error","filePath":"skills/taste-distillation/scripts/taste/falapi.py","lineNumber":270,"sourceCode":"    \"\"\"Submit once. Ambiguous failures must be reconciled before another job.\n\n    ``max_attempts`` is retained for call compatibility but never resubmits.\n    \"\"\"\n    if is_dry_run():\n        log.info(\"[dry-run] model request (payload omitted)\")\n        return _stub(endpoint, payload)\n\n    require_live()\n    api_key()\n    try:\n        result = _fal().subscribe(\n            endpoint, arguments=payload, with_logs=False, client_timeout=timeout,\n        )\n        return result if isinstance(result, dict) else {\"output\": result}\n    except Exception:\n        # Exception strings can include keys, signed URLs and provider payloads.\n        # Do not print or chain them into caller tracebacks.\n        raise FalError(\n            \"fal call failed after one attempt; job acceptance may be unknown. \"\n            \"Reconcile provider job status before requesting another generation.\"\n        ) from None\n\n\n# ---------------------------------------------------------------------------\n# uploads (cached)\n# ---------------------------------------------------------------------------\n\n_UPLOAD_CACHE: dict[tuple[str, int, int], str] = {}\n_UPLOAD_LOCK = threading.Lock()\n\n\ndef _cache_key(path: Path) -> tuple[str, int, int]:\n    st = path.stat()\n    return (str(path.resolve()), st.st_mtime_ns, st.st_size)\n\n","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/taste-distillation/scripts/taste/falapi.py#L252-L288","documentation":"FalError raised by submit() when the fal client call throws. It intentionally suppresses the original exception (`from None`) because exception strings can contain API keys, signed URLs, and provider payloads. It warns that job acceptance is unknown: the request may or may not have reached fal.ai, so blindly retrying could create duplicate paid generations.","triggerScenarios":"submit() wraps `_fal().submit/ run(endpoint, arguments=payload, ...)`; any exception there — network failure, timeout, HTTP error, auth rejection — triggers this error.","commonSituations":"Transient network drop mid-request; provider 5xx; expired/invalid FAL_KEY rejected server-side; timeout exceeded on a slow 3D generation endpoint.","solutions":["Check fal.ai dashboard/job status for the endpoint to reconcile whether the job was accepted before retrying","Retry the call once only after confirming no job was created (avoids double spend)","Verify FAL_KEY is valid and not expired if failures repeat","Add network/timeout logging outside falapi (the library intentionally omits details) to diagnose causes"],"exampleFix":"// before\nurl = falapi.submit(ENDPOINTS[\"text_to_image\"], payload)  # opaque FalError\n// after\ntry:\n    url = falapi.submit(ENDPOINTS[\"text_to_image\"], payload)\nexcept falapi.FalError:\n    status = reconcile_provider_job(endpoint, job_id)  # check acceptance first\n    if status is None:\n        url = falapi.submit(endpoint, payload)  # safe to retry now","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    result = falapi.submit(endpoint, payload)\nexcept falapi.FalError:\n    # Job acceptance unknown: reconcile provider state BEFORE retrying to avoid double spend\n    if not provider_job_exists(endpoint):\n        result = falapi.submit(endpoint, payload)\n    else:\n        result = fetch_existing_job_result(endpoint)","preventionTips":["Never retry blindly — the request may have been accepted and billed","Check the fal.ai dashboard or job-status API before re-submitting","Log request IDs/timestamps around submit() calls for reconciliation","Keep FAL_KEY valid; auth failures surface as this opaque error"],"tags":["python","network","api","provider"],"backgroundTag":"api-request-failed","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"}