# GAMS error codes :::{note} **In brief** — A quick-reference guide to the GAMS errors most commonly seen when running OPEN-PROM, separating compile-time errors (including domain violations) from execution-time solver and model-status issues and from licensing problems, with the likely cause and fix for each. ::: Encountering errors while working with GAMS is common, but knowing how to troubleshoot them saves time. This page summarises the errors most frequently met when running OPEN-PROM. It keeps two distinct categories apart: **compile-time errors**, which GAMS reports with a numeric `**** NNN` code while reading the model, and **execution-time solver and model-status issues**, which the solver reports (or which appear in the solve summary) only after compilation has succeeded. Licensing problems are listed last. ## Compile-time errors Compile-time errors occur while GAMS reads (compiles) the model, before any solve. To locate them, search for four asterisks (`****`) in the `.lst` file generated by GAMS. :::{tip} The `****` marker always sits at the start of the line where GAMS flags a problem, so a plain text search through the `.lst` file is the fastest way to jump to the offending statement. ::: | Code | Message | Cause | Fix | |---|---|---|---| | **101** | Syntax error, unexpected keyword in the declaration of a component | A syntax error in the GAMS code. | Double-check the syntax and make sure all keywords are spelled correctly. | | **102** | Symbol `xxx` already defined | A symbol is defined more than once. | Check for duplicate definitions of symbols (variables, equations, parameters) and ensure each is defined only once. | | **103** | Inconsistent equation definition | Inconsistencies in the definition of equations. | Review the equations and ensure they are correctly defined for the problem at hand. | | **170** | Domain violation for element | A set element is referenced that is not a member of the set declared for that index position — a typo, an element missing from the set declaration, or an external label that does not match the domain (for example a year header in an input CSV that does not match a `YTIME` label). | Check the referenced labels against the declaring set, and make sure external data (CSV headers and similar) use exactly the labels GAMS expects. | | **171** | Domain violation for set | The wrong set, or sets in the wrong order, is used for an index position (for example writing `d(j,i)` when `d` was declared over `(i,j)`). | Verify that each index uses the correct declaring set and that the indices appear in the declared order. | :::{tip} Error 170 is the one most often hit in the soft-link workflow: year column headers in `iPrices_magpie.csv` must be bare integers (`2010,2011,…`) so they match OPEN-PROM's `YTIME` labels — a `y` prefix or an out-of-range year triggers a domain violation. See {doc}`/guide/05_soft_linking`. ::: ## Execution-time solver and model-status issues The conditions below are **not** compile-time `**** NNN` codes. They are reported by the solver (CONOPT) or appear in the solve summary as `MODEL STATUS` / `SOLVE STATUS` only after compilation has succeeded, so they are diagnosed differently from the codes above. **Pre-triangular infeasibility.** Before its main iterations, CONOPT solves the recursively-determined (pre-triangular) part of the model. It reports a pre-triangular infeasibility when a variable forced by this part cannot meet its bounds. In OPEN-PROM this is frequently a numerical artefact of an over-tight triangular feasibility tolerance rather than a genuinely infeasible model; relaxing CONOPT's `Tol_Feas_Tria` (triangular feasibility tolerance), or revising the initial values and bounds, usually clears it. **Model infeasible.** A `MODEL STATUS` of *infeasible* means no point satisfies all constraints. Review the constraints and objective for conflicting or overly restrictive conditions; the listing flags the rows that are infeasible at the reported solution, which is the place to start. ## License errors **"The installed license is invalid" / "License has expired".** Ensure that the `gamslice.txt` file inside the installation `bin` folder is correct and holds valid license information. :::{warning} GAMS does not always read the license file from the `bin` folder. Check the file path quoted in the error message to confirm which license file GAMS is actually referencing. ::: ## General troubleshooting tips - **Check log files.** Review the GAMS log files for detailed error messages and diagnostic information. - **Consult the documentation.** The GAMS documentation and user guides explain error messages and offer troubleshooting advice. - **Update the GAMS version.** Newer versions may include bug fixes and improvements relevant to the error. - **Search forums and communities.** Solutions to common GAMS errors are often found in online forums; otherwise, post your question to seek help from experienced users. :::{seealso} The full list of GAMS return codes is documented at the official reference: . :::