abiosoft/colima · error
error parsing model info: %w
Error message
error parsing model info: %w
What it means
InspectDockerModel json.Unmarshals the trimmed stdout of docker model inspect into DockerModelInfo. The output was not the expected JSON object: the CLI emitted human-readable text, a warning preamble, or nothing; or a Docker version changed the inspect output schema so fields moved.
Source
Thrown at model/docker.go:107
if err := guest.RunQuiet("docker", "exec", "docker-model-runner", "ln", blobPath, bundlePath); err != nil {
return "", fmt.Errorf("failed to link model file: %w", err)
}
return bundlePath, nil
}
// InspectDockerModel returns information about a Docker model.
func InspectDockerModel(modelName string) (*DockerModelInfo, error) {
guest := lima.New(host.New())
output, err := guest.RunOutput("docker", "model", "inspect", modelName)
if err != nil {
return nil, fmt.Errorf("error inspecting model %q: %w", modelName, err)
}
var info DockerModelInfo
if err := json.Unmarshal([]byte(strings.TrimSpace(output)), &info); err != nil {
return nil, fmt.Errorf("error parsing model info: %w", err)
}
return &info, nil
}
// SetupOrUpdateDocker reinstalls Docker Model Runner in the VM.
func SetupOrUpdateDocker() error {
guest := lima.New(host.New())
log.Println("reinstalling Docker Model Runner...")
if err := guest.RunInteractive("docker", "model", "reinstall-runner"); err != nil {
return fmt.Errorf("error reinstalling Docker Model Runner: %w", err)
}
log.Println("Docker Model Runner reinstalled")
// Print installed versionView on GitHub (pinned to c3a5f9184d)
Solutions
- Capture the raw output manually: colima ssh -- docker model inspect <name> and compare it to the fields DockerModelInfo expects
- Update colima (which pins matching parsing) and/or the Docker engine in the VM to matching versions
- If the CLI supports it, request machine-readable output explicitly (docker model inspect --format json or equivalent) in a local patch
- On persistent mismatch, fall back to parsing docker model ls --json entries for the model
Example fix
// before
var info DockerModelInfo
if err := json.Unmarshal([]byte(strings.TrimSpace(output)), &info); err != nil {
return nil, fmt.Errorf("error parsing model info: %w", err)
}
// after: keep only the JSON object in the output
var info DockerModelInfo
trimmed := strings.TrimSpace(output)
if i := strings.Index(trimmed, "{"); i > 0 {
trimmed = trimmed[i:]
}
if err := json.Unmarshal([]byte(trimmed), &info); err != nil {
return nil, fmt.Errorf("error parsing model info: %w (output: %.200q)", err, output)
} Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-trim CLI chatter so only the JSON object is unmarshalled.
func extractJSON(s string) string {
if i := strings.Index(s, "{"); i >= 0 {
if j := strings.LastIndex(s, "}"); j > i {
return s[i : j+1]
}
}
return s
} Try / catch
var info DockerModelInfo
if err := json.Unmarshal([]byte(extractJSON(output)), &info); err != nil {
return nil, fmt.Errorf("error parsing model info: %w (docker model inspect output: %.200q)", err, output)
} Prevention
- Pin docker/colima versions that were released together — inspect output schema drifts across Docker releases
- Always include a truncated copy of the failing CLI output in parse errors
- Prefer structured output flags (json templates) over parsing human-oriented stdout when available
When it happens
Trigger: docker model inspect printing a banner/hint lines before JSON on some Docker versions; inspect writing to stdout an error string instead of failing; empty output when the CLI exits 0 without data; schema drift in newer Docker Model Runner releases.
Common situations: Colima version lagging behind a freshly updated Docker in the VM; locale/TTY-dependent CLI output; models with unusual metadata producing partial JSON.
Related errors
- could not determine hash for model %q
- error inspecting containers: %w
- error decoding docker response
- failed to parse model manifest: %w
- error inspecting model %q: %w
AI-assisted analysis of abiosoft/colima@c3a5f9184d (2026-08-15).
Data as JSON: /api/errors/ccb27cb197d4ddee.
Report an issue: GitHub.