{"record":{"id":"170bb8064fa0d822","repo":"abiosoft/colima","slug":"failed-to-parse-model-manifest-w","errorCode":null,"errorMessage":"failed to parse model manifest: %w","messagePattern":"failed to parse model manifest: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"model/docker.go","lineNumber":66,"sourceCode":"func findGGUFPath(guest environment.VM, modelHash string) (string, error) {\n\t// Standard bundle path used by Docker Model Runner for all models\n\tbundlePath := fmt.Sprintf(\"/models/bundles/sha256/%s/model/model.gguf\", modelHash)\n\n\t// Check if bundle already exists\n\tif err := guest.RunQuiet(\"docker\", \"exec\", \"docker-model-runner\", \"test\", \"-f\", bundlePath); err == nil {\n\t\treturn bundlePath, nil\n\t}\n\n\t// Bundle doesn't exist - read manifest to find the GGUF blob and create the bundle\n\tmanifestPath := fmt.Sprintf(\"/models/manifests/sha256/%s\", modelHash)\n\toutput, err := guest.RunOutput(\"docker\", \"exec\", \"docker-model-runner\", \"cat\", manifestPath)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to read model manifest: %w\", err)\n\t}\n\n\tvar manifest ociManifest\n\tif err := json.Unmarshal([]byte(output), &manifest); err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to parse model manifest: %w\", err)\n\t}\n\n\t// Find the GGUF layer (mediaType contains \"gguf\")\n\tvar blobPath string\n\tfor _, layer := range manifest.Layers {\n\t\tif strings.Contains(layer.MediaType, \"gguf\") {\n\t\t\tif blobHash, ok := strings.CutPrefix(layer.Digest, \"sha256:\"); ok {\n\t\t\t\tblobPath = fmt.Sprintf(\"/models/blobs/sha256/%s\", blobHash)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tif blobPath == \"\" {\n\t\treturn \"\", fmt.Errorf(\"no GGUF layer found in model manifest\")\n\t}\n\n\t// Create bundle directory and hard-link the blob (same approach as Docker Model Runner)","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/model/docker.go#L48-L84","documentation":"The manifest bytes read out of the runner container ('cat /models/manifests/sha256/<hash>') failed json.Unmarshal into ociManifest. The captured stdout was not valid JSON — typically because docker exec emitted a daemon error to stdout, the output was empty (container died mid-exec), or the manifest schema differs from the expected OCI layout.","triggerScenarios":"Runner container stopping between the test -f probe and the cat; docker CLI printing warnings/error text into stdout; an empty output when the manifest path exists but is a directory; upstream manifest format change (e.g. manifest lists) in a newer Model Runner.","commonSituations":"Flaky container lifecycle right after start; docker version mismatch between CLI in the VM and the runner container; truncated output on a slow VM.","solutions":["Run the failing command manually to see the raw output: colima ssh -- docker exec docker-model-runner cat /models/manifests/sha256/<hash>","Confirm the runner container is stable: docker ps | grep docker-model-runner (no Restarting), restart it if needed","Re-pull the model to regenerate the manifest","On persistent parse failure, update Docker/Model Runner and colima so manifest writing and reading versions match"],"exampleFix":"// before\noutput, err := guest.RunOutput(\"docker\", \"exec\", \"docker-model-runner\", \"cat\", manifestPath)\nvar manifest ociManifest\nif err := json.Unmarshal([]byte(output), &manifest); err != nil {\n    return \"\", fmt.Errorf(\"failed to parse model manifest: %w\", err)\n}\n\n// after: surface the payload that failed to parse\noutput, err := guest.RunOutput(\"docker\", \"exec\", \"docker-model-runner\", \"cat\", manifestPath)\nvar manifest ociManifest\nif err := json.Unmarshal([]byte(output), &manifest); err != nil {\n    return \"\", fmt.Errorf(\"failed to parse model manifest: %w (output: %.200q)\", err, output)\n}","handlingStrategy":"try-catch","validationCode":"// Cheap pre-check on the payload before unmarshalling.\nfunc looksLikeJSON(s string) bool {\n    t := strings.TrimSpace(s)\n    return strings.HasPrefix(t, \"{\") && strings.HasSuffix(t, \"}\")\n}","typeGuard":null,"tryCatchPattern":"var manifest ociManifest\nif err := json.Unmarshal([]byte(output), &manifest); err != nil {\n    // include the raw bytes: docker exec errors often arrive via stdout\n    return \"\", fmt.Errorf(\"failed to parse model manifest: %w (raw: %.200q)\", err, output)\n}","preventionTips":["Keep docker CLI in the VM and Docker Model Runner versions in sync via supported colima releases","Log/inspect the raw docker exec output whenever JSON parsing of CLI output fails","Prefer reading manifests as a single atomic cat after confirming the container is Running, not Restarting"],"tags":["json","manifest","docker","model-runner"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}