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 |
|
C++ |
|
Java |
|
.NET |
|
Python |
|
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.
In MATLAB and R, the error codes and corresponding messages are printed on the screen whenever an error occurs.
Possible error codes are:
Error code |
Error number |
Description |
---|---|---|
|
10001 |
Available memory was exhausted |
|
10002 |
|
|
10003 |
An invalid value was provided for a routine argument |
|
10004 |
Tried to query or set an unknown attribute |
|
10005 |
Attempted to query or set an attribute that could not be accessed at that time |
|
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 |
|
10007 |
Tried to query or set an unknown parameter |
|
10008 |
Tried to set a parameter to a value that is outside the parameter’s valid range |
|
10009 |
Failed to obtain a valid license |
|
10010 |
Attempted to solve a model that is larger than the limit for a demo license |
|
10011 |
Problem in callback |
|
10012 |
Failed to read the requested file |
|
10013 |
Failed to write the requested file |
|
10014 |
Numerical error during requested operation |
|
10015 |
Attempted to perform infeasibility analysis on a feasible model |
|
10016 |
Requested operation not valid for a MIP model |
|
10017 |
Tried to query or modify a model while optimization was in progress |
|
10018 |
Constraint, variable, or SOS contained duplicated indices |
|
10019 |
Error in reading or writing a node file during MIP optimization |
|
10020 |
Q matrix in QP model is not positive semi-definite |
|
10021 |
QCP equality constraint specified (only inequalities are supported if the NonConvex parameter is set to 0 or 1) |
|
10022 |
Problem communicating with the Gurobi Compute Server |
|
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) |
|
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) |
|
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 |
|
10026 |
Piecewise-linear objectives must have certain properties (as described
in the documentation for the various |
|
10027 |
The UpdateMode parameter can not be modified once a model has been created. |
|
10028 |
Problems launching a Gurobi Instant Cloud job. |
|
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. |
|
10030 |
When you are using a client-server feature, this error indicates that there was an application problem. |
|
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). |
|
10032 |
Indicates that an authentication step failed or that an operation was attempted for which the current credentials do not warrant permission. |
|
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. |
|
20002 |
Failed to create the requested model |
|
20003 |
Internal Gurobi error |