Error importing shapefile - wrong magic number

Hello,
I’m trying to import a shapefile on a Sentinel 1 stack, but get this message:


I don’t understand where the error is, does anyone know?
Tks!

Please post error message as text, not screen captures. Images can’t be searched, and it is more work to quote from the error text.

For the benefit of future searchers:

java.Lang.RuntimeException: Java.io.IOException: Wrong magic number, expected 9994, got [a different number].

A “magic number” is a numerical representation of a unique binary sequence placed at the beginning of many types of binary files to help software verify the type of binary file instead of relying on users to provide the appropriate extension. For example, the TIFF (Tagged Image File Format) is used with many different file extensions (.tiff, .tif, .TIF, .geotiff, etc.), but every TIFF file starts with either “II42” or “MM42”, depending on the byte order (II for Intel, MM for Motorola, 42 is the well known answer to everything).

See: Magic Number mismatch reported while importing shapefile

Linux and macOS users (or Windows users who have Msys2 or Cygwin ports of the linux utilities) can check the file type using the file command, and can print the shapefile magic number using the od command:

$ file X.shp
X.shp: ESRI Shapefile version 1000 length NNNN type ...
$  od --endian big -t d4 -N4 X.shp
0000000        9994
0000004
2 Likes

Many thanks for your answer @gnwiii , I will post future messages as text then.
Can you tell me how to modify this file? If I try to see it using nano or gedit editors, it shows a chain of signs like the following: @^@����^@^@^@�
Is the file editable? Can I change the magic number manually?
Apologize for my questions if they are too basics
cheers.

All questions are important – for every question that gets posted to the forum there are usually several more users who have similar questions but don’t post. That is why it is important to think not only about solving the immediate problem, but also leaving some hints for others who encounter similar issues.

You can’t “fix” the file with an editor. You need to figure out what type of file it is. It may have been corrupted (internet glitch, disk error) or may be some sort of archive containing a shapefile (note that a “shapefile” usually refers to a collection of files, so for downloading it could make sense to put the files in an archive). Maybe if you tell use more about the source of the shapefile someone will recognize the problem.

A rather late answer, but maybe some one else might find it useful.

This is an error might appear when a shapefile is read through geotools but the shapefile was corrupted. A redownlaod of the shapefile or the application might solve this issue.