Informix Error -502
-502 Cannot cluster index.
While the database server was building a new copy of the table with rows in clustered sequence, it got an unexpected error. Check the accompanying ISAM error code for more information. Typical causes include a shortage of disk space.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-502 fires while the database server is physically rebuilding a table in clustered order (as part
of ALTER INDEX ... TO CLUSTER) and something goes wrong partway through that rebuild.
- Insufficient free space in the dbspace holding the table, since clustering builds a complete second copy of the table before the original is dropped — per the official guidance, the typical cause.
- An underlying ISAM-level error during the rebuild (a lock conflict, an I/O error, a constraint violation surfacing mid-copy) — the official text points to checking the accompanying ISAM error code for the specific reason.
- Clustering attempted on a very large table without first confirming the target dbspace has headroom for a full second copy of the table plus its indexes.
Solutions / Resolution
- Check the accompanying ISAM error reported alongside -502 — it identifies the specific underlying failure rather than leaving it to guesswork.
- Check free space in the table's dbspace before retrying, since a shortage is the typical
cause per the official guidance:
to see chunk-level free-page counts for the dbspace(s) involved.onstat -d - Free space or add chunks to the dbspace, then retry the
ALTER INDEX ... TO CLUSTERstatement.
Examples
Diagnosing a clustering failure
ALTER INDEX idx_orders_new TO CLUSTER;
-- -502: Cannot cluster index.
-- (accompanying ISAM error, e.g. -111, reported alongside)
$ onstat -d
-- review free-page counts for the chunk(s) backing the table's dbspace
After freeing space
ALTER INDEX idx_orders_new TO CLUSTER;
-- succeeds once the dbspace has room for the rebuilt copy
Diagnostic Checks
- Read the ISAM error code accompanying -502 first — it narrows the cause before any dbspace investigation is needed.
- Run
onstat -dto confirm free-page availability in the relevant dbspace when the accompanying error points toward a space shortage.
Related Errors / Related Topics
- -500 — "Clustered index index-name already exists in the table." A different clustering restriction: cardinality, not a rebuild failure.
- -501 — "Index index-name is already not clustered." The companion no-op warning on the un-clustering side.
The message names the operation (clustering) but not the reason; the accompanying ISAM error is where the actual cause lives.