{"record":{"id":"53166a2b4bbf50ae","repo":"calesthio/OpenMontage","slug":"seedream-submit-succeeded-but-did-not-return-reque","errorCode":null,"errorMessage":"Seedream submit succeeded but did not return request_id","messagePattern":"Seedream submit succeeded but did not return request_id","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"tools/graphics/seedream_image.py","lineNumber":194,"sourceCode":"        }\n\n        try:\n            headers = {\n                \"Authorization\": f\"Key {api_key}\",\n                \"Content-Type\": \"application/json\",\n            }\n\n            submit_resp = requests.post(\n                submit_url,\n                headers=headers,\n                json=payload,\n                timeout=(10, 60),\n            )\n            submit_resp.raise_for_status()\n            submit_data = submit_resp.json()\n            request_id = submit_data.get(\"request_id\")\n            if not request_id:\n                raise RuntimeError(\n                    \"Seedream submit succeeded but did not return request_id\"\n                )\n            status_url = (\n                f\"https://queue.fal.run/bytedance/seedream/requests/\"\n                f\"{request_id}/status\"\n            )\n            elapsed = 0.0\n            while elapsed < 300:\n                status_resp = requests.get(\n                    status_url,\n                    headers=headers,\n                    timeout=30,\n                )\n                status_resp.raise_for_status()\n                status_data = status_resp.json()\n                status = status_data.get(\"status\")\n\n                if status == \"COMPLETED\":","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/graphics/seedream_image.py#L176-L212","documentation":"Raised when the Seedream submit POST to the fal.run queue endpoint returns HTTP success but the JSON body has no 'request_id'. The queue protocol requires a request id to build the status/result URLs, so without it the tool cannot poll and aborts. Usually indicates an auth/billing response shape, a gateway page, or an API contract change rather than a generation failure.","triggerScenarios":"FAL_KEY invalid/expired so the endpoint returns a 200 HTML or JSON error body; fal.run queue API changed its response key; a proxy intercepts the request and returns success with an empty body.","commonSituations":"Rotated fal.ai credentials; environment-specific egress proxies; API version drift on queue.fal.run.","solutions":["Print submit_data to see what actually came back (error message, HTML, empty dict)","Verify FAL_KEY is valid and the account has Seedream access","Confirm the submit_url and expected response schema against current fal.run queue docs","Retry once — transient gateway 200-with-error bodies do occur"],"exampleFix":"// before\nsubmit_data = submit_resp.json()\nrequest_id = submit_data.get(\"request_id\")\n// after\nsubmit_data = submit_resp.json()\nrequest_id = submit_data.get(\"request_id\") or submit_data.get(\"requestId\")\nif not request_id and \"error\" in submit_data:\n    raise RuntimeError(f\"Seedream submit rejected: {submit_data['error']}\")","handlingStrategy":"retry","validationCode":"# nothing caller-side can fully prevent a 200-without-request_id;\n# verify credentials first\nimport os\nassert os.environ.get(\"FAL_KEY\"), \"valid FAL_KEY required before seedream submit\"","typeGuard":null,"tryCatchPattern":"for attempt in range(2):\n    try:\n        return seedream_run(inputs)\n    except RuntimeError as e:\n        if \"did not return request_id\" in str(e) and attempt == 0:\n            continue  # transient gateway body; retry once\n        raise","preventionTips":["Keep FAL_KEY fresh and verify with a cheap fal call before long jobs","Log submit response bodies verbatim on failure","Alert on 200 responses lacking expected queue keys — early warning of schema drift"],"tags":["seedream","fal","queue-api","authentication","response-parsing"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}