Entropic 2.3.8
Local-first agentic inference engine
Loading...
Searching...
No Matches
error.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
9
10/* entropic_last_error moved to src/facade/entropic.cpp in v2.2.6
11 * (gh#58 follow-up). The TODO from v1.8.0 was finally implemented:
12 * the facade can see the private engine_handle struct and read
13 * handle->last_error directly. Pre-create errors still use a
14 * thread-local fallback owned by the facade. */
15
17static const char* const s_error_names[] = {
18 "ENTROPIC_OK", // 0
19 "ENTROPIC_ERROR_INVALID_ARGUMENT", // 1
20 "ENTROPIC_ERROR_INVALID_CONFIG", // 2
21 "ENTROPIC_ERROR_INVALID_STATE", // 3
22 "ENTROPIC_ERROR_MODEL_NOT_FOUND", // 4
23 "ENTROPIC_ERROR_LOAD_FAILED", // 5
24 "ENTROPIC_ERROR_GENERATE_FAILED", // 6
25 "ENTROPIC_ERROR_TOOL_NOT_FOUND", // 7
26 "ENTROPIC_ERROR_PERMISSION_DENIED", // 8
27 "ENTROPIC_ERROR_PLUGIN_VERSION_MISMATCH", // 9
28 "ENTROPIC_ERROR_PLUGIN_LOAD_FAILED", // 10
29 "ENTROPIC_ERROR_TIMEOUT", // 11
30 "ENTROPIC_ERROR_CANCELLED", // 12
31 "ENTROPIC_ERROR_OUT_OF_MEMORY", // 13
32 "ENTROPIC_ERROR_IO", // 14
33 "ENTROPIC_ERROR_INTERNAL", // 15
34 "ENTROPIC_ERROR_SERVER_ALREADY_EXISTS", // 16 (v1.8.7)
35 "ENTROPIC_ERROR_SERVER_NOT_FOUND", // 17 (v1.8.7)
36 "ENTROPIC_ERROR_CONNECTION_FAILED", // 18 (v1.8.7)
37 "ENTROPIC_ERROR_INVALID_HANDLE", // 19 (v1.8.9)
38 "ENTROPIC_ERROR_TOOL_EXECUTION_FAILED", // 20 (v1.8.9)
39 "ENTROPIC_ERROR_STORAGE_FAILED", // 21 (v1.8.9)
40 "ENTROPIC_ERROR_IDENTITY_NOT_FOUND", // 22 (v1.8.9)
41 "ENTROPIC_ERROR_ALREADY_RUNNING", // 23 (v1.8.9)
42 "ENTROPIC_ERROR_NOT_RUNNING", // 24 (v1.8.9)
43 "ENTROPIC_ERROR_NOT_IMPLEMENTED", // 25 (v1.8.9)
44 "ENTROPIC_ERROR_INTERRUPTED", // 26 (v1.8.9)
45 "ENTROPIC_ERROR_ADAPTER_NOT_FOUND", // 27 (v1.9.2)
46 "ENTROPIC_ERROR_ADAPTER_LOAD_FAILED", // 28 (v1.9.2)
47 "ENTROPIC_ERROR_ADAPTER_SWAP_FAILED", // 29 (v1.9.2)
48 "ENTROPIC_ERROR_ADAPTER_CANCELLED", // 30 (v1.9.2)
49 "ENTROPIC_ERROR_GRAMMAR_NOT_FOUND", // 31 (v1.9.3)
50 "ENTROPIC_ERROR_GRAMMAR_INVALID", // 32 (v1.9.3)
51 "ENTROPIC_ERROR_MCP_KEY_DENIED", // 33 (v1.9.4)
52 "ENTROPIC_ERROR_LIMIT_REACHED", // 34 (v1.9.6)
53 "ENTROPIC_ERROR_ALREADY_EXISTS", // 35 (v1.9.6)
54 "ENTROPIC_ERROR_IN_USE", // 36 (v1.9.6)
55 "ENTROPIC_ERROR_PROFILE_NOT_FOUND", // 37 (v1.9.7)
56 "ENTROPIC_ERROR_TIME_LIMIT_EXCEEDED", // 38 (v1.9.7)
57 "ENTROPIC_ERROR_VALIDATION_FAILED", // 39 (v1.9.8)
58 "ENTROPIC_ERROR_COMPACTION_FAILED", // 40 (v1.9.9)
59 "ENTROPIC_ERROR_MODEL_NOT_ACTIVE", // 41 (v1.9.10)
60 "ENTROPIC_ERROR_EVAL_CONTEXT_FULL", // 42 (v1.9.10)
61 "ENTROPIC_ERROR_EVAL_FAILED", // 43 (v1.9.10)
62 "ENTROPIC_ERROR_IMAGE_LOAD_FAILED", // 44 (v1.9.11)
63 "ENTROPIC_ERROR_IMAGE_TOO_LARGE", // 45 (v1.9.11)
64 "ENTROPIC_ERROR_MMPROJ_LOAD_FAILED", // 46 (v1.9.11)
65 "ENTROPIC_ERROR_UNSUPPORTED_URL", // 47 (v1.9.11)
66 "ENTROPIC_ERROR_NOT_SUPPORTED", // 48 (v1.9.13)
67 "ENTROPIC_ERROR_STATE_INCOMPATIBLE", // 49 (v1.9.13)
68 "ENTROPIC_ERROR_NO_VISION_TIER", // 50 (v2.1.8, gh#41)
69 "ENTROPIC_ERROR_QUEUE_FULL", // 51 (v2.1.10, gh#40)
70 "ENTROPIC_ERROR_SPECULATIVE_INCOMPATIBLE_ARCH", // 52 (v2.1.11, gh#36)
71 "ENTROPIC_ERROR_TIER_MODEL_TOO_LARGE", // 53 (v2.2.4, gh#57)
72};
73
74static constexpr int s_error_count =
75 static_cast<int>(sizeof(s_error_names) / sizeof(s_error_names[0]));
76
84extern "C" const char* entropic_error_name(entropic_error_t code) {
85 int idx = static_cast<int>(code);
86 return (idx >= 0 && idx < s_error_count) ? s_error_names[idx] : "ENTROPIC_ERROR_UNKNOWN";
87}
88
99 entropic_handle_t handle,
101 void* user_data) {
102 // TODO(v1.8.4): Store callback on per-handle state.
103 (void)callback;
104 (void)user_data;
105 if (handle == nullptr) {
107 }
108 return ENTROPIC_OK;
109}
const char * entropic_error_name(entropic_error_t code)
Get the human-readable name for an error code.
Definition error.cpp:84
static const char *const s_error_names[]
Lookup table: error code → name string.
Definition error.cpp:17
entropic_error_t entropic_set_error_callback(entropic_handle_t handle, entropic_error_callback_t callback, void *user_data)
Register an error callback on a handle.
Definition error.cpp:98
Error types for cross-.so error reporting.
void(* entropic_error_callback_t)(entropic_error_t code, const char *message, void *user_data)
Error callback type for async error reporting.
Definition error.h:145
entropic_error_t
Error codes returned by all C API functions.
Definition error.h:35
@ ENTROPIC_OK
Success.
Definition error.h:36
@ ENTROPIC_ERROR_INVALID_ARGUMENT
NULL pointer, empty string, out-of-range value.
Definition error.h:37
Engine handle struct — owns all subsystems.