Try our new documentation site (beta).


Error Codes

Errors can arise in most of the Gurobi library routines. In the C interface, library routines return an integer error code. In the C++, Java, .NET, and Python interfaces, Gurobi methods can throw an exception (a C++ exception, a Java exception, a .NET exception, or a Python exception)

Underlying all Gurobi error reporting is a set of error codes. These are integer values, but we recommend that you use one of the predefined error code constants to check the error status in your program. Each error code has a name, and each language requires a prefix on this name to obtain the appropriate constant. You would access error code OUT_OF_MEMORY in the following ways from the available Gurobi interfaces:

Language Error Code
C GRB_ERROR_OUT_OF_MEMORY
C++ GRB_ERROR_OUT_OF_MEMORY
Java GRB.Error.OUT_OF_MEMORY
.NET GRB.Error.OUT_OF_MEMORY
Python GRB.Error.OUT_OF_MEMORY

Note that when an error occurs, it produces both an error code and an error message. The message can be obtained through GRBgeterrormessage in C, through GRBException::getMessage() in C++, through the inherited getMessage() method on the GRBException class in Java, through the inherited Message property on the GRBException class in .NET, or through the e.message attribute on the GurobiError object in Python.

Possible error codes are:

Error code Error number Description
OUT_OF_MEMORY 10001 Available memory was exhausted
NULL_ARGUMENT 10002 NULL input value provided for a required argument
INVALID_ARGUMENT 10003 An invalid value was provided for a routine argument
UNKNOWN_ATTRIBUTE 10004 Tried to query or set an unknown attribute
DATA_NOT_AVAILABLE 10005 Attempted to query or set an attribute that could not be accessed at that time
INDEX_OUT_OF_RANGE 10006 Tried to query or set an attribute, but one or more of the provided indices (e.g., constraint index, variable index) was outside the range of valid values
UNKNOWN_PARAMETER 10007 Tried to query or set an unknown parameter
VALUE_OUT_OF_RANGE 10008 Tried to set a parameter to a value that is outside the parameter's valid range
NO_LICENSE 10009 Failed to obtain a valid license
SIZE_LIMIT_EXCEEDED 10010 Attempted to solve a model that is larger than the limit for a demo license
CALLBACK 10011 Problem in callback
FILE_READ 10012 Failed to read the requested file
FILE_WRITE 10013 Failed to write the requested file
NUMERIC 10014 Numerical error during requested operation
IIS_NOT_INFEASIBLE 10015 Attempted to perform infeasibility analysis on a feasible model
NOT_FOR_MIP 10016 Requested operation not valid for a MIP model
OPTIMIZATION_IN_PROGRESS 10017 Tried to query or modify a model while optimization was in progress
DUPLICATES 10018 Constraint, variable, or SOS contained duplicated indices
NODEFILE 10019 Error in reading or writing a node file during MIP optimization
Q_NOT_PSD 10020 Q matrix in QP model is not positive semi-definite
QCP_EQUALITY_CONSTRAINT 10021 QCP equality constraint specified (only inequalities are supported unless the NonConvex parameter is set to 2)
NETWORK 10022 Problem communicating with the Gurobi Compute Server
JOB_REJECTED 10023 Gurobi Compute Server responded, but was unable to process the job (typically because the queuing time exceeded the user-specified timeout or because the queue has exceeded its maximum capacity)
NOT_SUPPORTED 10024 Indicates that a Gurobi feature is not supported under your usage environment (for example, some advanced features are not supported in a Compute Server environment)
EXCEED_2B_NONZEROS 10025 Indicates that the user has called a query routine on a model with more than 2 billion non-zero entries, and the result would exceed the maximum size that can be returned by that query routine. The solution is typically to move to the GRBX version of that query routine.
INVALID_PIECEWISE_OBJ 10026 Piecewise-linear objectives must have certain properties (as described in the documentation for the various setPWLObj methods). This error indicates that one of those properties was violated.
UPDATEMODE_CHANGE 10027 The UpdateMode parameter can not be modified once a model has been created.
CLOUD 10028 Problems launching a Gurobi Instant Cloud job.
MODEL_MODIFICATION 10029 Indicates that the user has modified the model in such a way that the model became invalid. For example, this happens when a general constraint exists in the model and the user deletes the resultant variable of this constraint. In such a case, the general constraint does not have any meaningful interpretation anymore. The solution is to also delete the general constraint when a resultant variable is deleted.
CSWORKER 10030 When you are using a client-server feature, this error indicates that there was an application problem.
TUNE_MODEL_TYPES 10031 Indicates that tuning was invoked on a set of models, but the models were of different types (e.g., one an LP, another a MIP).
SECURITY 10032 Indicates that an authentication step failed or that an operation was attempted for which the current credentials do not warrant permission.
NOT_IN_MODEL 20001 Tried to use a constraint or variable that is not in the model, either because it was removed or because it has not yet been added.
FAILED_TO_CREATE_MODEL 20002 Failed to create the requested model
INTERNAL 20003 Internal Gurobi error

Try Gurobi for Free

Choose the evaluation license that fits you best, and start working with our Expert Team for technical guidance and support.

Evaluation License
Get a free, full-featured license of the Gurobi Optimizer to experience the performance, support, benchmarking and tuning services we provide as part of our product offering.
Academic License
Gurobi supports the teaching and use of optimization within academic institutions. We offer free, full-featured copies of Gurobi for use in class, and for research.
Cloud Trial

Request free trial hours, so you can see how quickly and easily a model can be solved on the cloud.

Search

Gurobi Optimization