{"record":{"id":"68aab8e1211342e1","repo":"xtekky/gpt4free","slug":"r-status-response-body-text","errorCode":null,"errorMessage":"{r.status} {response body text}","messagePattern":"\\{r\\.status\\} \\{response body text\\}","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"g4f/Provider/audio/ElevenLabs.py","lineNumber":171,"sourceCode":"            'error-callback': (e) => rej(new Error('hcaptcha: ' + e))\n        }});\n        hcaptcha.execute(w);\n    }});\n    const r = await fetch(\n        'https://api.elevenlabs.io/v1/text-to-speech/' + {_voice} + '/stream/with-timestamps/anonymous?output_format=' + {_format},\n        {{\n            method: 'POST',\n            headers: {{'Content-Type': 'application/json'}},\n            body: JSON.stringify({{\n                text: {_text},\n                model_id: {_model},\n                voice_settings: {{speed: 1}},\n                hcaptcha_token: token,\n                language_code: {_lang}\n            }})\n        }}\n    );\n    if (!r.ok) throw new Error(r.status + ' ' + await r.text());\n    const reader = r.body.getReader(), dec = new TextDecoder();\n    let buf = '', chunks = [];\n    while (true) {{\n        const {{done, value}} = await reader.read();\n        if (done) break;\n        buf += dec.decode(value, {{stream: true}});\n        const lines = buf.split('\\\\n');\n        buf = lines.pop() || '';\n        for (const ln of lines) {{\n            const t = ln.trim();\n            if (!t) continue;\n            // Accept both plain NDJSON and SSE \"data:\" prefixed lines\n            const d = t.startsWith('data:') ? t.slice(5).trim() : t;\n            try {{\n                const p = JSON.parse(d);\n                if (p.audio_base64) chunks.push(p.audio_base64);\n            }} catch (e) {{}}\n        }}","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/xtekky/gpt4free/blob/973504e1770928ed5fb82f43da528f441ad9ddc3/g4f/Provider/audio/ElevenLabs.py#L153-L189","documentation":"Thrown by the Go wrapper when it cannot stat a python interpreter inside the downloaded runtime directory (binDir/python-home). The code probes platform-specific candidate paths (python-home/python.exe on Windows, python-home/bin/python on unix) and errors when none exists as a regular file. It almost always means the embedded pbs (python-build-standalone) runtime was never extracted or the extraction produced an unexpected layout.","triggerScenarios":"Calling any g4f-go entrypoint that resolves the interpreter (pythonExecutable) before EnsureRuntime/extractEmbedded has run, or after extraction failed silently; also when binDir points at a stale or manually pruned directory where python-home exists but the interpreter file is missing or is a directory.","commonSituations":"First run on a fresh machine without running the runtime bootstrap; a partial download/extraction interrupted midway; an antivirus or sync tool quarantining the python binary; binDir overridden via config to a path that was never populated; non-standard pbs archive layout with the interpreter at a different relative path.","solutions":["Re-run the runtime bootstrap (the command that triggers runtime download/extraction, e.g. re-run g4f-go so extractEmbedded reinstalls) so python-home is populated","Verify the expected path exists: ls <binDir>/python-home/bin/python (unix) or <binDir>/python-home/python.exe (windows); if python-home is missing or empty, delete binDir and retry for a clean extraction","Check the extraction step's logs for a prior 'extract embedded runtime' or 'no embedded runtime archive' failure and fix that first","If binDir is configurable, confirm it points to the directory the runtime was actually installed into, not a fresh/incorrect path","On unix, confirm the interpreter file is a regular file with execute permission and not renamed by the archive layout (update candidates list if the pbs layout version changed)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"func runtimeReady(binDir string) bool {\n    home := filepath.Join(binDir, \"python-home\")\n    exe := filepath.Join(home, \"python.exe\")\n    if runtime.GOOS != \"windows\" {\n        exe = filepath.Join(home, \"bin\", \"python\")\n    }\n    fi, err := os.Stat(exe)\n    return err == nil && !fi.IsDir()\n}\n\n// call before any API that spawns the interpreter:\nif !runtimeReady(binDir) {\n    // run the runtime install/bootstrap flow first\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always run the runtime bootstrap/ensure step at process start and treat its failure as fatal before resolving the interpreter","Keep binDir fixed in config so the runtime location never drifts between runs","After extraction, write a stamp file and check it instead of probing paths repeatedly"],"tags":["runtime","python","bootstrap","filesystem"],"backgroundTag":null,"analyzedSha":"973504e1770928ed5fb82f43da528f441ad9ddc3","analyzedAt":"2026-08-14T23:45:32.408Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}