Skip to content

Misc. bug: Multi-model router does not support slot save/restore operations #18703

Description

@eleqtrizit

Name and Version

Environment

  • llama.cpp version: version: 7653 (193ee38)
  • Operating System: Ubuntu 24 Linux
  • Build: Standard build with CUDA support

Description

When running llama-server with --models-preset (multi-model router mode), the slot save/restore endpoints return 400 Bad Request with error message "Invalid action", even though the server is started with --slot-save-path.

Expected Behavior

The slot save/restore operations should work with multi-model router mode, just as they do with single-model mode.

Actual Behavior

The router's proxy_post handler (in tools/server/server-models.cpp:828) intercepts the request and attempts to proxy it to the individual model server, but the slot-specific endpoints are not handled correctly by the proxy logic.

Root Cause

In tools/server/server.cpp:155, when --models-preset is used:

routes.post_slots = models_routes->proxy_post;

The proxy_post handler expects standard request patterns but doesn't properly handle the slot save/restore operations which require:

  • Path parameter :id_slot
  • Query parameter ?action=save|restore|erase
  • Special handling that differs from standard model inference requests

Workaround

Connect directly to the individual model server ports instead of the router port. The individual model servers support slot save/restore correctly.

Suggested Fix

The multi-model router should either:

  1. Pass through slot operations directly to the target model server without modification
  2. Implement proper slot save/restore handling in the router itself
  3. Document that slot operations are not supported in multi-model mode

Additional Context

The slot save/restore functionality works correctly when running llama-server in single-model mode (without --models-preset). The issue only affects the multi-model router mode introduced for managing multiple models from a single endpoint.

Operating systems

No response

Which llama.cpp modules do you know to be affected?

No response

Command line

llama-server --models-preset models.ini --host 0.0.0.0 --port 8081 --models-max 1 --slot-save-path /tmp/kvcache --swa-full -np 2

Problem description & steps to reproduce

Steps to Reproduce

  1. Start llama-server with multi-model router:
llama-server --models-preset /path/to/models.ini --host 0.0.0.0 --port 8081 --models-max 1 --slot-save-path /tmp/kvcache --swa-full -np 2
  1. Attempt to save a slot:
❯ curl -X POST 'http://127.0.0.1:8081/slots/0?action=save' \
  -H 'Content-Type: application/json' \
  -d '{"filename": "test_save", "model": "ggml-org/gpt-oss-20b-GGUF"}'
{"error":{"code":400,"message":"Invalid action","type":"invalid_request_error"}}%   
  1. Connect directly to llama-server behind the proxy:
❯ curl -X POST 'http://127.0.0.1:42515/slots/0?action=save' \
  -H 'Content-Type: application/json' \
  -d '{"filename": "test_save", "model": "ggml-org/gpt-oss-20b-GGUF"}'
{"id_slot":0,"filename":"test_save","n_saved":0,"n_written":36,"timings":{"save_ms":0.399}}%  

First Bad Commit

No response

Relevant log output

No response

Metadata

Metadata

Labels

bugSomething isn't workingregressionA regression introduced in a new build (something that was previously working correctly)serverserver/webui

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions