{"record":{"id":"e9b1fabdd63a0206","repo":"mudler/LocalAI","slug":"1-e9b1fa","errorCode":"1","errorMessage":"[sam3-cpp] Failed to load model: %s\\n","messagePattern":"\\[sam3-cpp\\] Failed to load model: (.+?)\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/go/sam3-cpp/cpp/gosam3.cpp","lineNumber":51,"sourceCode":"        if (mask.width > 0 && mask.height > 0 && !mask.data.empty()) {\n            stbi_write_png_to_func(png_write_callback, &g_mask_pngs[i],\n                                   mask.width, mask.height, 1,\n                                   mask.data.data(), mask.width);\n        }\n    }\n}\n\nextern \"C\" {\n\nint sam3_cpp_load_model(const char *model_path, int threads) {\n    sam3_params params;\n    params.model_path = model_path;\n    params.n_threads = threads;\n    params.use_gpu = true;\n\n    g_model = sam3_load_model(params);\n    if (!g_model) {\n        fprintf(stderr, \"[sam3-cpp] Failed to load model: %s\\n\", model_path);\n        return 1;\n    }\n\n    g_state = sam3_create_state(*g_model, params);\n    if (!g_state) {\n        fprintf(stderr, \"[sam3-cpp] Failed to create state\\n\");\n        g_model.reset();\n        return 2;\n    }\n\n    fprintf(stderr, \"[sam3-cpp] Model loaded: %s (threads=%d)\\n\", model_path, threads);\n    return 0;\n}\n\nint sam3_cpp_encode_image(const char *image_path) {\n    if (!g_model || !g_state) {\n        fprintf(stderr, \"[sam3-cpp] Model not loaded\\n\");\n        return 1;","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/mudler/LocalAI/blob/44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26/backend/go/sam3-cpp/cpp/gosam3.cpp#L33-L69","documentation":"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.","triggerScenarios":"Thrown at backend/go/sam3-cpp/cpp/gosam3.cpp:51 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26","analyzedAt":"2026-08-15T10:13:50.291Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}