]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
server: print actual model name in 'model not found" error (#19117)
authorMatthieu Coudron <redacted>
Mon, 2 Feb 2026 15:55:27 +0000 (16:55 +0100)
committerGitHub <redacted>
Mon, 2 Feb 2026 15:55:27 +0000 (16:55 +0100)
Experimenting with AI, my environment gets messy fast and it's not
always easy to know what model my software is trying to load. This helps
with troubleshooting.

before:

Error: {
  code = 400,
  message = "model not found",
  type = "invalid_request_error"
}

After:

Error: {
  code = 400,
  message = "model 'toto' not found",
  type = "invalid_request_error"
}

tools/server/server-models.cpp

index 803cb02e6eeb8b6228df23cc13e20fc2207e62c5..57655476afa794b2a4adea0d87c5b19f709c3bb4 100644 (file)
@@ -767,7 +767,7 @@ static bool router_validate_model(const std::string & name, server_models & mode
     }
     auto meta = models.get_meta(name);
     if (!meta.has_value()) {
-        res_err(res, format_error_response("model not found", ERROR_TYPE_INVALID_REQUEST));
+        res_err(res, format_error_response(string_format("model '%s' not found", name.c_str()), ERROR_TYPE_INVALID_REQUEST));
         return false;
     }
     if (models_autoload) {