Skip to content

fix: change Antigravity field from map to array to match remote models.json format#2

Open
I3eg1nner wants to merge 1 commit into
chainreactors:mainfrom
I3eg1nner:main
Open

fix: change Antigravity field from map to array to match remote models.json format#2
I3eg1nner wants to merge 1 commit into
chainreactors:mainfrom
I3eg1nner:main

Conversation

@I3eg1nner

Copy link
Copy Markdown

Problem

The binary built from main panics on startup with:
panic: registry: failed to parse embedded models.json: embed: decode models
catalog: json: cannot unmarshal array into Go struct field
staticModelsJSON.antigravity of type
mapstring*registry.AntigravityModelConfig

Root Cause

The remote models.json (maintained at router-for-me/models) changed the antigravity section from a map format to an array format — consistent with all other sections (claude, gemini, codex-*, etc.). However, staticModelsJSON in internal/registry/model_definitions.go still declared Antigravity as map[string]*AntigravityModelConfig.
This is a runtime contract mismatch — Go compilation succeeds regardless, so CI cannot catch it.

Changes

  • Add AntigravityModelEntry struct with an ID field to support array-based model entries
  • Change staticModelsJSON.Antigravity from map[string]*AntigravityModelConfig to []*AntigravityModelEntry
  • Update GetAntigravityModelConfig() to iterate over the array
  • Update LookupStaticModelInfo() to search the array by ID
  • Update validateAntigravitySection() to validate array entries, now with duplicate ID detection

Verification

The commit compiles cleanly and passes all existing tests. The remote models.json at https://raw.githubusercontent.com/router-for-me/models/refs/heads/main/models.json now parses successfully.

…s.json

The remote models.json (router-for-me/models) changed antigravity
from a map format to an array format (consistent with all other
sections like claude, gemini, etc.). However, the Go struct in
staticModelsJSON still expected a map, causing the binary to panic
on startup with:

  " json: cannot unmarshal array into Go struct field
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants