xtekky/gpt4free · error
runtime.json: no platforms defined
Error message
runtime.json: no platforms defined
What it means
parseRuntimeManifest in g4f-go/download.go json.Unmarshals runtime.json and requires the Platforms map to be non-empty. An empty or missing 'platforms' object yields 'runtime.json: no platforms defined' — the manifest is structurally valid JSON but carries no runtime entries to install.
Source
Thrown at g4f-go/download.go:480
}
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
- Inspect runtime.json and confirm it has a populated lowercase 'platforms' object with per-OS/arch entries
- Restore the manifest from the upstream repo instead of a locally stripped copy
- Match the manifest schema to the Go struct (platforms -> map[string]RuntimeSpec with url/size/sha256)
- If embedding the manifest, rebuild the binary after fixing the JSON
Example fix
// before
// runtime.json: {"version": "1.0"} -> no platforms defined
// after
// runtime.json
{
"platforms": {
"linux-x64": {"url": "https://host/r-linux-x64.tar.gz", "size": 29140615, "sha256": "..."},
"darwin-arm64": {"url": "https://host/r-darwin-arm64.tar.gz", "size": 1, "sha256": "..."}
}
} Defensive patterns
Strategy: validation
Validate before calling
var m RuntimeManifest
if err := json.Unmarshal(data, &m); err == nil && len(m.Platforms) == 0 {
// reject the manifest before install: no platforms to serve
} Type guard
func manifestHasPlatforms(m *RuntimeManifest) bool {
return m != nil && len(m.Platforms) > 0
} Try / catch
m, err := parseRuntimeManifest(data)
if err != nil {
if strings.Contains(err.Error(), "no platforms defined") {
// fetch/restore the canonical runtime.json
}
return err
} Prevention
- Lint runtime.json in CI: non-empty platforms, lowercase keys, url/size/sha256 present
- Never hand-strip manifest entries without replacing the file
- Rebuild binaries after embedding a fixed manifest
When it happens
Trigger: Passing a runtime.json whose 'platforms' key is absent, null, or {} (a template file, a mistakenly stripped config, or a failed write that produced '{}').
Common situations: Hand-editing runtime.json and deleting entries; CI copying a placeholder manifest; a fetch of the manifest that returned an empty JSON object; key-name drift ('Platforms' vs 'platforms') in a differently-versioned file.
Related errors
- Invalid AZURE_API_KEYS environment variable
- Invalid AZURE_ROUTES environment variable format: {routes}
- no runtime in manifest for platform %q
- download failed: HTTP %s
- size mismatch: got %d, expected %d (update runtime.json)
AI-assisted analysis of xtekky/gpt4free@973504e177 (2026-08-14).
Data as JSON: /api/errors/5a47d115978c68dc.
Report an issue: GitHub.