{"record":{"id":"d313916ee5048a82","repo":"xtekky/gpt4free","slug":"python-runtime-extracted-but-s-is-missing","errorCode":null,"errorMessage":"python runtime extracted but %s is missing","messagePattern":"python runtime extracted but (.+?) is missing","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"g4f-go/download.go","lineNumber":468,"sourceCode":"}\n\n// finalizeRuntime does platform-specific finishing (launcher setup) and\n// returns the interpreter path.\nfunc finalizeRuntime(binDir string) (string, error) {\n\t// Android builds the dlopen C runner instead of a shell launcher.\n\tif runtime.GOOS == \"android\" {\n\t\treturn finalizeAndroidRuntime(binDir)\n\t}\n\t// Write the unix launcher (windows uses python.exe from the archive).\n\tif err := writeLauncher(binDir); err != nil {\n\t\treturn \"\", err\n\t}\n\texe, err := pythonExecutable(binDir)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif _, err := os.Stat(exe); err != nil {\n\t\treturn \"\", fmt.Errorf(\"python runtime extracted but %s is missing\", exe)\n\t}\n\treturn exe, nil\n}\n\n// parseRuntimeManifest decodes a RuntimeManifest from bytes.\nfunc parseRuntimeManifest(data []byte) (*RuntimeManifest, error) {\n\tvar m RuntimeManifest\n\tif err := json.Unmarshal(data, &m); err != nil {\n\t\treturn nil, err\n\t}\n\tif len(m.Platforms) == 0 {\n\t\treturn nil, fmt.Errorf(\"runtime.json: no platforms defined\")\n\t}\n\treturn &m, nil\n}\n","sourceCodeStart":450,"sourceCodeEnd":484,"githubUrl":"https://github.com/xtekky/gpt4free/blob/973504e1770928ed5fb82f43da528f441ad9ddc3/g4f-go/download.go#L450-L484","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Look inside the extraction dir for the actual binary location and compare with the expected path in the error message","Clear .g4f-runtime and re-run so manifest and archive download consistently from one release","Update g4f-go to a version matching the current runtime.json layout","On Windows, check antivirus quarantine logs if python.exe vanished after extraction"],"exampleFix":"# before\n# python runtime extracted but /path/.g4f-runtime/py/bin/python3 is missing\n\n# after\nfind .g4f-runtime -name 'python*' -type f   # locate the real binary\nrm -rf .g4f-runtime                          # reset and re-bootstrap\ng4f  # updated binary + matching manifest extract a consistent layout","handlingStrategy":"validation","validationCode":"if exe, err := pythonExecutable(binDir); err == nil {\n    if _, statErr := os.Stat(exe); statErr != nil {\n        // layout mismatch: warn before invoking the runtime\n    }\n}","typeGuard":null,"tryCatchPattern":"exe, err := ensureRuntime(binDir)\nif err != nil && strings.Contains(err.Error(), \"is missing\") {\n    // wipe .g4f-runtime, align binary and runtime.json versions, re-bootstrap\n}","preventionTips":["Keep the g4f-go binary and runtime.json from the same release","Check antivirus exclusions for the extracted python binary on Windows","Smoke-test os.Stat(exe) after bootstrap in deployment scripts"],"tags":["go","runtime-bootstrap","python","layout-mismatch","antivirus"],"backgroundTag":null,"analyzedSha":"973504e1770928ed5fb82f43da528f441ad9ddc3","analyzedAt":"2026-08-14T23:45:32.408Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}