router-for-me/CLIProxyAPI · error
home models payload contains no models
Error message
home models payload contains no models
What it means
decodeHomeModels parsed one or more sections but ended with zero usable entries: every model object either lacked a non-empty 'id' (or a 'name' usable as fallback id) or was not a string. After sorting, len(out) == 0 triggers this error as a final sanity check.
Source
Thrown at internal/api/server_routes.go:1022
if displayName == "" {
displayName, _ = model["displayName"].(string)
displayName = strings.TrimSpace(displayName)
}
out = append(out, homeModelEntry{
id: id,
created: homeModelInt64Value(model, "created"),
ownedBy: ownedBy,
displayName: displayName,
contextLength: int(homeModelInt64Value(model, "context_length", "contextLength", "inputTokenLimit", "max_input_tokens")),
maxCompletionTokens: int(homeModelInt64Value(model, "max_completion_tokens", "maxCompletionTokens", "outputTokenLimit", "max_tokens")),
})
}
}
sort.Slice(out, func(i, j int) bool { return out[i].id < out[j].id })
if len(out) == 0 {
return nil, fmt.Errorf("home models payload contains no models")
}
return out, nil
}
func homeModelInt64Value(model map[string]any, keys ...string) int64 {
for _, key := range keys {
switch value := model[key].(type) {
case float64:
return int64(value)
case int64:
return value
case int:
return int64(value)
case json.Number:
if n, errInt := value.Int64(); errInt == nil {
return n
}
case string:View on GitHub (pinned to 78f0c4079e)
Solutions
- Dump one raw model object from the payload to check the id/name field names actually present
- If the schema changed, update the field extraction in decodeHomeModels (id, name keys) to the new names
- If sections legitimately contain no models, treat this as an empty catalog instead of an error
Defensive patterns
Strategy: validation
Validate before calling
sample := firstModelObject(raw)
if sample != nil && strField(sample, "id") == "" && strField(sample, "name") == "" {
// schema drift: id field renamed — do not treat as model list
} Prevention
- Log one raw model object when zero entries are extracted
- Watch upstream schema changes before they empty your catalog
When it happens
Trigger: Sections exist but their arrays are empty; model objects use a renamed id field (e.g. 'model' or 'slug') so every id resolves to ''; entries are not JSON objects (e.g. arrays of strings).
Common situations: Upstream schema change renaming 'id'; a feed that returns section metadata objects instead of model lists.
Related errors
- home models payload is empty
- parse home models payload: %w
- home models payload has no sections
- auth file not found
- realtime_client_secret_capacity_exhausted
AI-assisted analysis of router-for-me/CLIProxyAPI@78f0c4079e (2026-08-15).
Data as JSON: /api/errors/e4793f890f7194af.
Report an issue: GitHub.