xtekky/gpt4free · error

python runtime extracted but %s is missing

Error message

python runtime extracted but %s is missing

What it means

finalizeRuntime (g4f-go/download.go) locates the Python executable with pythonExecutable(binDir) after extraction and stats it. If the file does not exist on disk, it errors with 'python runtime extracted but %s is missing' — the archive extracted without error but its layout does not match what this code expects (no bin/python or equivalent at the anticipated path).

Source

Thrown at g4f-go/download.go:468

}

// finalizeRuntime does platform-specific finishing (launcher setup) and
// returns the interpreter path.
func finalizeRuntime(binDir string) (string, error) {
	// Android builds the dlopen C runner instead of a shell launcher.
	if runtime.GOOS == "android" {
		return finalizeAndroidRuntime(binDir)
	}
	// Write the unix launcher (windows uses python.exe from the archive).
	if err := writeLauncher(binDir); err != nil {
		return "", err
	}
	exe, err := pythonExecutable(binDir)
	if err != nil {
		return "", err
	}
	if _, err := os.Stat(exe); err != nil {
		return "", fmt.Errorf("python runtime extracted but %s is missing", exe)
	}
	return exe, nil
}

// parseRuntimeManifest decodes a RuntimeManifest from bytes.
func parseRuntimeManifest(data []byte) (*RuntimeManifest, error) {
	var m RuntimeManifest
	if err := json.Unmarshal(data, &m); err != nil {
		return nil, err
	}
	if len(m.Platforms) == 0 {
		return nil, fmt.Errorf("runtime.json: no platforms defined")
	}
	return &m, nil
}

View on GitHub (pinned to 973504e177)

Solutions

  1. Look inside the extraction dir for the actual binary location and compare with the expected path in the error message
  2. Clear .g4f-runtime and re-run so manifest and archive download consistently from one release
  3. Update g4f-go to a version matching the current runtime.json layout
  4. On Windows, check antivirus quarantine logs if python.exe vanished after extraction

Example fix

# before
# python runtime extracted but /path/.g4f-runtime/py/bin/python3 is missing

# after
find .g4f-runtime -name 'python*' -type f   # locate the real binary
rm -rf .g4f-runtime                          # reset and re-bootstrap
g4f  # updated binary + matching manifest extract a consistent layout
Defensive patterns

Strategy: validation

Validate before calling

if exe, err := pythonExecutable(binDir); err == nil {
    if _, statErr := os.Stat(exe); statErr != nil {
        // layout mismatch: warn before invoking the runtime
    }
}

Try / catch

exe, err := ensureRuntime(binDir)
if err != nil && strings.Contains(err.Error(), "is missing") {
    // wipe .g4f-runtime, align binary and runtime.json versions, re-bootstrap
}

Prevention

When it happens

Trigger: A runtime archive with an unexpected internal layout (python binary at a different path), an extraction that silently skipped the executable (permissions), or a manifest pointing at an archive that is not the expected Python distribution.

Common situations: Upstream changes the archive structure between releases while the Go bootstrap expects the old one; version mismatch between an old g4f-go binary and a new runtime.json; antivirus quarantining the extracted python binary on Windows.

Related errors


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