xtekky/gpt4free · error · RuntimeError

Failed to get conversation ID from /new: {new_data}

Error message

Failed to get conversation ID from /new: {new_data}

What it means

The stdlib archive/zip extraction of the embedded pbs runtime into binDir failed; the wrapped error carries the real cause (unsupported compression, checksum mismatch, or a filesystem error while writing entries like ENOSPC or EACCES).

Source

Thrown at g4f/Provider/BraveSearch.py:311

                "source": "newThread" if is_deep else "llmSuggest",
                "enable_research": "true" if is_deep else "false",
                "q": prompt,
                "nonce": nonce,
                "sig": sig,
            }

            async with session.get(
                NEW_ENDPOINT,
                params=new_params,
                headers={
                    "referer": f"{BRAVE_ASK_URL}?q={quote(prompt)}&source=newThread"
                },
            ) as response:
                await raise_for_status(response)
                new_data = await response.json()
                conversation.conversation_id = new_data.get("id")
                if not conversation.conversation_id:
                    raise RuntimeError(
                        f"Failed to get conversation ID from /new: {new_data}"
                    )
                debug.log(
                    f"BraveSearch: Conversation ID: {conversation.conversation_id}"
                )

            yield conversation
            yield ProviderInfo(**cls.get_dict(), model=model)

            # ===== STEP 3: Stream the response =====
            stream_params = {
                "language": "en",
                "country": "us",
                "ui_lang": "en-us",
                "safesearch": "moderate",
                "force_safesearch": "0",
                "units_of_measurement": "metric",
                "use_location": "1",

View on GitHub (pinned to 973504e177)

Solutions

  1. Read the wrapped error: a zip.ErrChecksum/ErrFormat means a corrupt archive → re-fetch and rebuild; an os error like ENOSPC/EACCES means an environment problem
  2. Remove the partial install dir (rm -rf <binDir>/python-home) and retry so extraction starts clean
  3. Free disk space or fix permissions on binDir (chown/chmod) so the process can write the full runtime layout
  4. On Windows, close any process holding files inside python-home (previous python run, antivirus scan) before retrying
  5. If the archive is genuinely truncated, rerun fetch-python.sh and verify the zip opens with unzip -t before rebuilding
Defensive patterns

Strategy: validation

Validate before calling

func canExtract(binDir string) error {
    if err := os.MkdirAll(binDir, 0o755); err != nil {
        return fmt.Errorf("binDir not writable: %w", err)
    }
    probe := filepath.Join(binDir, ".write-probe")
    if err := os.WriteFile(probe, nil, 0o644); err != nil {
        return fmt.Errorf("binDir not writable: %w", err)
    }
    _ = os.Remove(probe)
    return nil
}

Try / catch

if err := extractZip(...); err != nil {
    // wipe partial state so the next attempt is clean, then surface
    _ = os.RemoveAll(filepath.Join(binDir, "python-home"))
    return fmt.Errorf("extract embedded runtime: %w", err)
}

Prevention

When it happens

Trigger: Embedded zip is corrupt (bad CRC, unsupported method); binDir or python-home is not writable; disk full during extraction; extraction hits an existing read-only file from a previous partial install; symlink/permission entries in the archive that os-level writes reject.

Common situations: Leftover partial extraction from a previous crashed run making files read-only or locked (Windows file locks especially); installing into a directory owned by another user; container image with a read-only layer; truncated archive from a flaky fetch step.

Related errors


AI-assisted analysis of xtekky/gpt4free@973504e177 (2026-08-14). Data as JSON: /api/errors/2b2db5d623acb59b. Report an issue: GitHub.