Informix Error -466
-466 File length error.
This statement stores a value in a BYTE or TEXT column from a file. The locator structures specified a length for the data in loc_locsize, but the database server found end of file before it had read that much data. Review the program to ensure that the input file was properly positioned and that the correct length was specified. Specify a length of -1 if the file should be read to its end. If this is a 4GL program, this error should not occur. If the error recurs, note all circumstances and contact IBM Informix Technical Support.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-466 fires when loading a file's content into a BYTE/TEXT column: the locator's
loc_locsize field specified a length to read, but the server hit end-of-file before reading
that much data — the file is genuinely smaller than the locator claims.
loc_locsizeset to a value larger than the file's actual size — a mismatch between the locator's stated length and reality.- Incorrect file positioning before the read — if the file's read position was already
advanced (e.g. by a prior partial read), less data remains than
loc_locsizeexpects. - The file was truncated externally after the locator's size was determined but before the actual read occurred.
Solutions / Resolution
- Verify proper file positioning and correct length specification, per the official guidance, before the read.
- Use
-1inloc_locsizeto read to end of file instead of a hardcoded length, per the official guidance, if the exact length isn't reliably known in advance. - If using a higher-level language (4GL) where this shouldn't normally occur, treat its appearance as a signal worth investigating, per the official guidance, and contact IBM Informix Technical Support if the problem persists.
Examples
Using -1 to read to end of file instead of a hardcoded length
loc_t my_loc;
memset(&my_loc, 0, sizeof(my_loc));
my_loc.loc_loctype = LOCFNAME;
my_loc.loc_fname = "/tmp/blob_input";
my_loc.loc_locsize = -1; /* read to end of file, rather than
a potentially stale hardcoded size */
Checking the file's actual size before setting loc_locsize
ls -la /tmp/blob_input
-- confirm the file's actual size matches what loc_locsize
-- claims before attempting the read
Diagnostic Checks
- Compare
loc_locsizeagainst the file's actual current size. - Check the file's read position before the operation, in case a prior partial read left it somewhere unexpected.
- Check whether the file was truncated externally between when its size was determined and when the read occurred.
Related Errors / Related Topics
- -463 — "File read error." A related file-loading failure, at a more general OS-level read- error level rather than this specific length-mismatch condition.
- -451 — "Locator buffer size too small." A related locator-sizing error, on the output- buffer side rather than the input-file-length side.
Use -1 for loc_locsize to read to end of file rather than a hardcoded length, unless the exact
byte count is reliably known and guaranteed not to change.