mudler/LocalAI · error
1
1
Error message
[sam3-cpp] Failed to load model: %s\n
What it means
sam3-cpp failed to load the model file. Guard: check the model path exists, is readable, and has a plausible size/extension before calling the loader; return a clear LoadModel error.
Source
Thrown at backend/go/sam3-cpp/cpp/gosam3.cpp:51
if (mask.width > 0 && mask.height > 0 && !mask.data.empty()) {
stbi_write_png_to_func(png_write_callback, &g_mask_pngs[i],
mask.width, mask.height, 1,
mask.data.data(), mask.width);
}
}
}
extern "C" {
int sam3_cpp_load_model(const char *model_path, int threads) {
sam3_params params;
params.model_path = model_path;
params.n_threads = threads;
params.use_gpu = true;
g_model = sam3_load_model(params);
if (!g_model) {
fprintf(stderr, "[sam3-cpp] Failed to load model: %s\n", model_path);
return 1;
}
g_state = sam3_create_state(*g_model, params);
if (!g_state) {
fprintf(stderr, "[sam3-cpp] Failed to create state\n");
g_model.reset();
return 2;
}
fprintf(stderr, "[sam3-cpp] Model loaded: %s (threads=%d)\n", model_path, threads);
return 0;
}
int sam3_cpp_encode_image(const char *image_path) {
if (!g_model || !g_state) {
fprintf(stderr, "[sam3-cpp] Model not loaded\n");
return 1;View on GitHub (pinned to 44413a9d06)
Solutions
- Verify the model path is correct and the file exists and is readable.
- Confirm the model file is a valid SAM 3 checkpoint compatible with sam3-cpp.
- Check file permissions and available disk/memory during load.
When it happens
Trigger: Thrown at backend/go/sam3-cpp/cpp/gosam3.cpp:51 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of mudler/LocalAI@44413a9d06 (2026-08-15).
Data as JSON: /api/errors/e9b1fabdd63a0206.
Report an issue: GitHub.