{"record":{"id":"91147318ee932c55","repo":"abiosoft/colima","slug":"failed-to-inspect-model-q-w","errorCode":null,"errorMessage":"failed to inspect model %q: %w","messagePattern":"failed to inspect model %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"model/docker.go","lineNumber":198,"sourceCode":"// ServeDockerModel serves a Docker model with llama-server.\n// It runs llama-server interactively (with visible output) and uses socat to forward the port.\n// The function blocks until interrupted (Ctrl-C) or llama-server exits.\n// Note: Call EnsureDockerModel first to ensure the model is available.\nfunc ServeDockerModel(cfg DockerModelServeConfig) error {\n\tguest := lima.New(host.New())\n\n\t// Set defaults\n\tif cfg.Threads <= 0 {\n\t\tcfg.Threads = 2\n\t}\n\tif cfg.GPULayers <= 0 {\n\t\tcfg.GPULayers = 999\n\t}\n\n\t// Get the model info (model should already be available via EnsureDockerModel)\n\tmodelInfo, err := InspectDockerModel(cfg.ModelName)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to inspect model %q: %w\", cfg.ModelName, err)\n\t}\n\n\t// Check model format - only GGUF models are supported\n\tif modelInfo.Config.Format != \"gguf\" {\n\t\treturn fmt.Errorf(\"model %q has format %q, only GGUF models are supported\\n\"+\n\t\t\t\"Try a GGUF version of this model (e.g., from TheBloke on HuggingFace)\",\n\t\t\tcfg.ModelName, modelInfo.Config.Format)\n\t}\n\n\tmodelHash := modelInfo.Hash()\n\tif modelHash == \"\" {\n\t\treturn fmt.Errorf(\"could not determine hash for model %q\", cfg.ModelName)\n\t}\n\n\t// Ensure docker-model-runner container is running (needed to find GGUF path)\n\tif err := ensureDockerModelRunner(guest); err != nil {\n\t\treturn err\n\t}","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/model/docker.go#L180-L216","documentation":"ServeDockerModel starts by calling InspectDockerModel(cfg.ModelName); failure wraps into this error. Same root causes as error 226 (model absent, docker model CLI problems, runner down), plus the documented contract that callers run EnsureDockerModel first so the model exists before serving.","triggerScenarios":"Calling ServeDockerModel directly without EnsureDockerModel; serving a model removed since the ensure step; runner stopped between ensure and serve; docker model subcommand unavailable.","commonSituations":"Scripts that skip the ensure step to save a round trip; long-lived sessions where the model was pruned; colima VM restarted between ensure and serve.","solutions":["Call EnsureDockerModel(cfg.ModelName) before ServeDockerModel (the function comment requires it)","Reproduce with colima ssh -- docker model inspect <name> and fix per error 226","If the model was pruned, re-pull it and retry","Verify docker model support in the VM (docker model version) and update if missing"],"exampleFix":"// before\nerr := ServeDockerModel(cfg)\n\n// after\nif _, err := EnsureDockerModel(cfg.ModelName); err != nil {\n    return err\n}\nerr := ServeDockerModel(cfg)","handlingStrategy":"validation","validationCode":"// Enforce ServeDockerModel's documented precondition.\nif _, err := EnsureDockerModel(cfg.ModelName); err != nil {\n    return err\n}\nerr := ServeDockerModel(cfg)","typeGuard":null,"tryCatchPattern":"modelInfo, err := InspectDockerModel(cfg.ModelName)\nif err != nil {\n    return fmt.Errorf(\"failed to inspect model %q: %w — was EnsureDockerModel called first?\", cfg.ModelName, err)\n}","preventionTips":["Always pair ServeDockerModel with a prior EnsureDockerModel call (the doc comment requires it)","In long-running scripts, re-ensure if the VM or runner restarted since the last serve","Wrap serve entry points so the ensure step cannot be skipped by callers"],"tags":["docker","model-runner","serve","ordering"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}