include/entropic/types/error.h

← API

include/entropic/types/error.h

Functions

ENTROPIC_EXPORT const char * entropic_last_error(entropic_handle_t handle)

Get the last error message for a handle.

Returns the error message from the most recent failed operation on this handle. The returned string is owned by the handle and valid until the next API call on the same handle. Get the last error message for a handle. Pre-v2.2.6 the public symbol lived in src/types/error.cpp and ignored its handle parameter (v1.8.0 TODO never done). Moved here because the private engine_handle struct is only visible in the facade. Returns a thread-local cache copy so the pointer stays valid until the same thread reads again — matches the v1.8.0 contract documented in include/entropic/types/error.h.

Parameters
  • handle — Engine handle (may be NULL for global errors during create).
Returns
  • Null-terminated error message string, or "" if no error. Owned by the handle — do NOT free.
  • Thread-local copy of this handle's last error message; the empty string when there is none. Never NULL, never freed by the caller.

ENTROPIC_EXPORT const char * entropic_error_name(entropic_error_t code)

Get the human-readable name for an error code.

Parameters
  • code — Error code.
  • code — Error code to look up.
Returns
  • Static string like "ENTROPIC_ERROR_LOAD_FAILED". Never NULL.
  • Static string naming the error code. Never NULL.

ENTROPIC_EXPORT entropic_error_t entropic_set_error_callback(entropic_handle_t handle, entropic_error_callback_t callback, void *user_data)

NOT IMPLEMENTED — reserved.

Returns ENTROPIC_ERROR_NOT_IMPLEMENTED. Through v2.10.4 this returned ENTROPIC_OK, so a consumer registering a callback got success and then silence — the engine claiming a capability it does not have. As of v2.11.0 it reports ENTROPIC_ERROR_NOT_IMPLEMENTED so the absence is visible at the call site instead of at 3am. Retrieve errors with entropic_last_error() until this is implemented. NOT IMPLEMENTED — reserved.

Parameters
  • handle — Engine handle.
  • callback — Ignored.
  • user_data — Ignored.
  • callback — Callback function, or NULL to remove.
  • user_data — Opaque pointer forwarded to callback.
Returns
  • ENTROPIC_ERROR_INVALID_ARGUMENT if handle is NULL, otherwise ENTROPIC_ERROR_NOT_IMPLEMENTED.
  • ENTROPIC_OK on success, ENTROPIC_ERROR_INVALID_ARGUMENT if handle is NULL.

Enums

entropic_error_t

Error codes returned by all C API functions.

ENTROPIC_OK (0) on success. All other values indicate failure. Use entropic_error_name() to get a human-readable string for logging.

  • ENTROPIC_OK 0
  • ENTROPIC_ERROR_INVALID_ARGUMENT
  • ENTROPIC_ERROR_INVALID_CONFIG
  • ENTROPIC_ERROR_INVALID_STATE
  • ENTROPIC_ERROR_MODEL_NOT_FOUND
  • ENTROPIC_ERROR_LOAD_FAILED
  • ENTROPIC_ERROR_GENERATE_FAILED
  • ENTROPIC_ERROR_TOOL_NOT_FOUND
  • ENTROPIC_ERROR_PERMISSION_DENIED
  • ENTROPIC_ERROR_PLUGIN_VERSION_MISMATCH
  • ENTROPIC_ERROR_PLUGIN_LOAD_FAILED
  • ENTROPIC_ERROR_TIMEOUT
  • ENTROPIC_ERROR_CANCELLED
  • ENTROPIC_ERROR_OUT_OF_MEMORY
  • ENTROPIC_ERROR_IO
  • ENTROPIC_ERROR_INTERNAL
  • ENTROPIC_ERROR_SERVER_ALREADY_EXISTS
  • ENTROPIC_ERROR_SERVER_NOT_FOUND
  • ENTROPIC_ERROR_CONNECTION_FAILED
  • ENTROPIC_ERROR_INVALID_HANDLE
  • ENTROPIC_ERROR_TOOL_EXECUTION_FAILED
  • ENTROPIC_ERROR_STORAGE_FAILED
  • ENTROPIC_ERROR_IDENTITY_NOT_FOUND
  • ENTROPIC_ERROR_ALREADY_RUNNING
  • ENTROPIC_ERROR_NOT_RUNNING
  • ENTROPIC_ERROR_NOT_IMPLEMENTED
  • ENTROPIC_ERROR_INTERRUPTED
  • ENTROPIC_ERROR_ADAPTER_NOT_FOUND
  • ENTROPIC_ERROR_ADAPTER_LOAD_FAILED
  • ENTROPIC_ERROR_ADAPTER_SWAP_FAILED
  • ENTROPIC_ERROR_ADAPTER_CANCELLED
  • ENTROPIC_ERROR_GRAMMAR_NOT_FOUND
  • ENTROPIC_ERROR_GRAMMAR_INVALID
  • ENTROPIC_ERROR_MCP_KEY_DENIED
  • ENTROPIC_ERROR_LIMIT_REACHED
  • ENTROPIC_ERROR_ALREADY_EXISTS
  • ENTROPIC_ERROR_IN_USE
  • ENTROPIC_ERROR_PROFILE_NOT_FOUND
  • ENTROPIC_ERROR_TIME_LIMIT_EXCEEDED
  • ENTROPIC_ERROR_VALIDATION_FAILED
  • ENTROPIC_ERROR_COMPACTION_FAILED
  • ENTROPIC_ERROR_MODEL_NOT_ACTIVE
  • ENTROPIC_ERROR_EVAL_CONTEXT_FULL
  • ENTROPIC_ERROR_EVAL_FAILED
  • ENTROPIC_ERROR_IMAGE_LOAD_FAILED
  • ENTROPIC_ERROR_IMAGE_TOO_LARGE
  • ENTROPIC_ERROR_MMPROJ_LOAD_FAILED
  • ENTROPIC_ERROR_UNSUPPORTED_URL
  • ENTROPIC_ERROR_NOT_SUPPORTED
  • ENTROPIC_ERROR_STATE_INCOMPATIBLE
  • ENTROPIC_ERROR_NO_VISION_TIER
  • ENTROPIC_ERROR_QUEUE_FULL
  • ENTROPIC_ERROR_SPECULATIVE_INCOMPATIBLE_ARCH
  • ENTROPIC_ERROR_TIER_MODEL_TOO_LARGE
  • ENTROPIC_ERROR_SPECULATIVE_INCOMPATIBLE_CONFIG
  • ENTROPIC_ERROR_MLOCK_LIMIT_EXCEEDED
  • ENTROPIC_ERROR_TURN_FAILED

Types

typedef struct entropic_engine* entropic_handle_t

Opaque handle to an entropic engine instance.

All per-handle functions (including entropic_last_error) operate on this. Created by entropic_create(), destroyed by entropic_destroy().

typedef void(* entropic_error_callback_t) (entropic_error_t code, const char *message, void *user_data) hook point

Error callback type for async error reporting.

Registered via entropic_set_error_callback(). Called from the thread where the error occurs. The callback MUST NOT call back into the entropic API (deadlock risk). Keep callbacks short — log and return.

Parameters
  • code — Error code.
  • message — Null-terminated error message. Valid only for callback duration.
  • user_data — Opaque pointer passed during registration.