errorcode-filemanagement.md 14.1 KB
Newer Older
A
Annie_wang 已提交
1
# File Management Error Codes
2 3 4 5 6

> **NOTE**
>
> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md).

A
Annie_wang 已提交
7
The error codes of the file management subsystem consist of the following:<br>- Basic file I/O error codes<br>- User data management error codes<br>- User file access error codes<br>- Spatial statistics error codes
A
Annie_wang 已提交
8 9 10 11 12 13

## Basic File I/O Error Codes

### 13900001 Operation Not Permitted

**Error Message**
14

A
Annie_wang 已提交
15 16 17
Operation not permitted

**Possible Causes**
18

A
Annie_wang 已提交
19 20 21
The current operation on the file is not allowed.

**Solution**
22

A
Annie_wang 已提交
23 24 25 26 27
Check the permission for the file.

### 13900002 File or Directory Not Exist

**Error Message**
28

A
Annie_wang 已提交
29 30 31
No such file or directory

**Possible Causes**
32

A
Annie_wang 已提交
33 34 35
The file or directory does not exist.

**Solution**
36

A
Annie_wang 已提交
37 38 39 40 41
Check whether the file directory exists.

### 13900003 Process Not Exist

**Error Message**
42

A
Annie_wang 已提交
43 44 45
No such process

**Possible Causes**
46

A
Annie_wang 已提交
47 48 49
The process does not exist.

**Solution**
50

A
Annie_wang 已提交
51 52 53 54 55 56
1. Check whether the process is killed unexpectedly.
2. Check whether the service related to the process has started.

### 13900004 System Call Interrupted

**Error Message**
57

A
Annie_wang 已提交
58 59 60
Interrupted system call

**Possible Causes**
61

A
Annie_wang 已提交
62 63 64
The system call is interrupted by another thread.

**Solution**
65

A
Annie_wang 已提交
66 67 68 69 70 71
1. Check the multi-thread code logic.
2. Invoke the system call again.

### 13900005 I/O Error

**Error Message**
72

A
Annie_wang 已提交
73 74 75
I/O error

**Possible Causes**
76

A
Annie_wang 已提交
77 78 79
The I/O request is invalid.

**Solution**
80

A
Annie_wang 已提交
81 82 83 84 85
Initiate the I/O request again.

### 13900006 Device or Address Not Exist

**Error Message**
86

A
Annie_wang 已提交
87 88 89
No such device or address

**Possible Causes**
90

A
Annie_wang 已提交
91 92 93
The device information or address is incorrect.

**Solution**
94

A
Annie_wang 已提交
95 96 97 98 99
Check that the device information or address is correct.

### 13900007 Long Parameter List

**Error Message**
100

A
Annie_wang 已提交
101 102 103
Arg list too long

**Possible Causes**
104

A
Annie_wang 已提交
105 106 107
The parameter list is too long.

**Solution**
108

A
Annie_wang 已提交
109 110 111 112 113
Reduce the number of parameters.

### 13900008 Invalid File Descriptor

**Error Message**
114

A
Annie_wang 已提交
115 116 117
Bad file descriptor

**Possible Causes**
118

A
Annie_wang 已提交
119 120 121
This file descriptor is closed.

**Solution**
122

A
Annie_wang 已提交
123 124 125 126 127
Check whether the file descriptor is closed.

### 13900009 Child Process Not Exist

**Error Message**
128

A
Annie_wang 已提交
129 130 131
No child processes

**Possible Causes**
132

A
Annie_wang 已提交
133 134 135
The child process cannot be created.

**Solution**
136

A
Annie_wang 已提交
137 138 139 140 141
Check the maximum number of processes in the system.

### 13900010 Resource Unavailable

**Error Message**
142

A
Annie_wang 已提交
143 144 145
Try again

**Possible Causes**
146

A
Annie_wang 已提交
147 148 149
The resources are blocked.

**Solution**
150

A
Annie_wang 已提交
151 152 153 154 155
Request resources.

### 13900011 Memory Overflow

**Error Message**
156

A
Annie_wang 已提交
157 158 159
Out of memory

**Possible Causes**
160

A
Annie_wang 已提交
161 162 163 164 165 166 167 168 169
A memory overflow occurs.

**Solution**
1. Check the memory overhead.
2. Control the memory overhead.

### 13900012 Permission Denied

**Error Message**
170

A
Annie_wang 已提交
171 172 173
Permission denied

**Possible Causes**
174 175 176



A
Annie_wang 已提交
177 178 179 180 181 182 183 184 185 186
1. You do not have the permission to operate the file.
2. The file sandbox path is incorrect.

**Solution**
1. Check that you have the permission to operate the file.
2. Check that the file sandbox path is correct.

### 13900013 Incorrect Address

**Error Message**
187

A
Annie_wang 已提交
188 189 190
Bad address

**Possible Causes**
191

A
Annie_wang 已提交
192 193 194
The address is incorrect.

**Solution**
195

A
Annie_wang 已提交
196 197 198 199 200
Check that the address is correct.

### 13900014 Device or Resource Not Available

**Error Message**
201

A
Annie_wang 已提交
202 203 204
Device or resource busy

**Possible Causes**
205

A
Annie_wang 已提交
206 207 208
The requested resource is unavailable.

**Solution**
209

A
Annie_wang 已提交
210 211 212 213 214
Request the resource again.

### 13900015 File Already Exists

**Error Message**
215

A
Annie_wang 已提交
216 217 218
File exists

**Possible Causes**
219

A
Annie_wang 已提交
220 221 222
The file to be created already exists.

**Solution**
223

A
Annie_wang 已提交
224 225 226 227 228
Check whether the file path is correct.

### 13900016 Invalid Cross-Device Link

**Error Message**
229

A
Annie_wang 已提交
230 231 232
Cross-device link

**Possible Causes**
233

A
Annie_wang 已提交
234 235 236
The link between devices is incorrect.

**Solution**
237

A
Annie_wang 已提交
238 239 240 241 242
Check the devices and create the link correctly.

### 13900017 Device Not Exist

**Error Message**
243

A
Annie_wang 已提交
244 245 246
No such device

**Possible Causes**
247

A
Annie_wang 已提交
248 249 250
The device is not identified.

**Solution**
251

A
Annie_wang 已提交
252 253 254 255 256
Check the connection to the target device.

### 13900018 Invalid Directory

**Error Message**
257

A
Annie_wang 已提交
258 259 260
Not a directory

**Possible Causes**
261

A
Annie_wang 已提交
262 263 264
The specified directory is invalid.

**Solution**
265

A
Annie_wang 已提交
266 267 268 269 270
Check that the directory is correct.

### 13900019 The Specified Object Is a Directory

**Error Message**
271

A
Annie_wang 已提交
272 273 274
Is a directory

**Possible Causes**
275

A
Annie_wang 已提交
276 277 278
The specified object is a directory.

**Solution**
279

A
Annie_wang 已提交
280 281 282 283 284
Check that the specified data is correct.

### 13900020 Invalid Parameter

**Error Message**
285

A
Annie_wang 已提交
286 287 288
Invalid argument

**Possible Causes**
289

A
Annie_wang 已提交
290 291 292
Invalid input parameter is detected.

**Solution**
293

A
Annie_wang 已提交
294 295 296 297 298
Check that the input parameters are valid.

### 13900021 Too Many File Descriptors Opened

**Error Message**
299

A
Annie_wang 已提交
300 301 302
File table overflow

**Possible Causes**
303

A
Annie_wang 已提交
304 305 306
The number of file descriptors opened has reached the limit.

**Solution**
307

A
Annie_wang 已提交
308 309 310 311 312
Close the file descriptors that are no longer required.

### 13900022 Too Many Files Opened

**Error Message**
313

A
Annie_wang 已提交
314 315 316
Too many open files

**Possible Causes**
317

A
Annie_wang 已提交
318 319 320
The number of files opened has reached the limit.

**Solution**
321

A
Annie_wang 已提交
322 323 324 325 326
Close the files that are not required.

### 13900023 Text File Not Respond

**Error Message**
327

A
Annie_wang 已提交
328 329 330
Text file busy

**Possible Causes**
331

A
Annie_wang 已提交
332 333 334
The executable file of the program is in use.

**Solution**
335

A
Annie_wang 已提交
336 337 338 339 340
Close the program that is being debugged.

### 13900024 File Oversized

**Error Message**
341

A
Annie_wang 已提交
342 343 344
File too large

**Possible Causes**
345

A
Annie_wang 已提交
346 347 348
The file size exceeds the limit.

**Solution**
349

A
Annie_wang 已提交
350 351 352 353 354
Check whether the file size exceeds the limit.

### 13900025 Insufficient Space on the Device

**Error Message**
355

A
Annie_wang 已提交
356 357 358
No space left on device

**Possible Causes**
359

A
Annie_wang 已提交
360 361 362
The device storage space is insufficient.

**Solution**
363

A
Annie_wang 已提交
364 365 366 367 368
Clear the space of the device.

### 13900026 Invalid Shift

**Error Message**
369

A
Annie_wang 已提交
370 371 372
Illegal seek

**Possible Causes**
373

A
Annie_wang 已提交
374 375 376
Seek is used in pipe or FIFO.

**Solution**
377

A
Annie_wang 已提交
378 379 380 381 382
Check the use of seek.

### 13900027 Read-Only File System

**Error Message**
383

A
Annie_wang 已提交
384 385 386
Read-only file system

**Possible Causes**
387

A
Annie_wang 已提交
388 389 390
The file system allows read operations only.

**Solution**
391

A
Annie_wang 已提交
392 393 394 395 396
Check whether the file is read-only.

### 13900028 Links Reach the Limit

**Error Message**
397

A
Annie_wang 已提交
398 399 400
Too many links

**Possible Causes**
401

A
Annie_wang 已提交
402 403 404
The number of links to the file has reached the limit.

**Solution**
405

A
Annie_wang 已提交
406 407 408 409 410
Delete the links that are no longer required.

### 13900029 Resource Deadlock

**Error Message**
411

A
Annie_wang 已提交
412 413 414
Resource deadlock would occur

**Possible Causes**
415

A
Annie_wang 已提交
416 417 418
Resource deadlock occurs.

**Solution**
419

A
Annie_wang 已提交
420 421 422 423 424
Terminate the deadlock process.

### 13900030 Long File Name

**Error Message**
425

A
Annie_wang 已提交
426 427 428
Filename too Long

**Possible Causes**
429

A
Annie_wang 已提交
430 431 432
The length of the path or file name exceeds the limit.

**Solution**
433

A
Annie_wang 已提交
434 435 436 437 438
Modify the path or file name.

### 13900031 Function Not Implemented

**Error Message**
439

A
Annie_wang 已提交
440 441 442
Function not implemented

**Possible Causes**
443

A
Annie_wang 已提交
444 445 446
The function is not supported by the system.

**Solution**
447

A
Annie_wang 已提交
448 449 450 451 452
Check the system version and update the system if required.

### 13900032 Directory Not Empty

**Error Message**
453

A
Annie_wang 已提交
454 455 456
Directory not empty

**Possible Causes**
457

A
Annie_wang 已提交
458 459 460
The specified directory is not empty.

**Solution**
461

A
Annie_wang 已提交
462 463 464 465 466 467
1. Check the directory.
2. Ensure that the directory is empty.

### 13900033 Too Many Symbol Links

**Error Message**
468

A
Annie_wang 已提交
469 470 471
Too many symbolic links

**Possible Causes**
472

A
Annie_wang 已提交
473 474 475
There are too many symbolic links.

**Solution**
476

A
Annie_wang 已提交
477 478 479 480 481
Delete unnecessary symbol links.

### 13900034 Operation Blocked

**Error Message**
482

A
Annie_wang 已提交
483 484 485
Operation would block

**Possible Causes**
486

A
Annie_wang 已提交
487 488 489
The operation is blocked.

**Solution**
490

A
Annie_wang 已提交
491 492 493 494 495
Perform the operation again.

### 13900035 Invalid File Descriptor

**Error Message**
496 497

Invalid request descriptor
A
Annie_wang 已提交
498 499

**Possible Causes**
500

A
Annie_wang 已提交
501 502 503
The requested file descriptor is invalid.

**Solution**
504

A
Annie_wang 已提交
505 506 507 508 509
Check that the file descriptor is valid.

### 13900036 Target Is Not a Character Stream Device

**Error Message**
510

A
Annie_wang 已提交
511 512 513
Device not a stream

**Possible Causes**
514

A
Annie_wang 已提交
515 516 517
The device pointed to by the file descriptor is not a character stream device.

**Solution**
518

A
Annie_wang 已提交
519 520 521 522 523
Check whether the file descriptor points to a stream device.

### 13900037 No Data Available

**Error Message**
524

A
Annie_wang 已提交
525 526 527
No data available

**Possible Causes**
528

A
Annie_wang 已提交
529 530 531
The required data is not available.

**Solution**
532

A
Annie_wang 已提交
533 534 535 536 537
Request the data again.

### 13900038 Value Mismatches the Data Type

**Error Message**
538

A
Annie_wang 已提交
539 540 541
Value too large for defined data type

**Possible Causes**
542

A
Annie_wang 已提交
543 544 545
The specified value is out of the range defined for the data type.

**Solution**
546

A
Annie_wang 已提交
547 548 549 550 551
Modify the data type.

### 13900039 File Descriptor Corrupted

**Error Message**
552

A
Annie_wang 已提交
553 554 555
File descriptor in bad state

**Possible Causes**
556

A
Annie_wang 已提交
557 558 559
The file descriptor is corrupted.

**Solution**
560

A
Annie_wang 已提交
561 562 563 564 565
Check that the file descriptor is valid.

### 13900040 System Call Interrupted

**Error Message**
566 567

Interrupted system call should be restarted
A
Annie_wang 已提交
568 569

**Possible Causes**
570

A
Annie_wang 已提交
571 572 573
The system call is interrupted.

**Solution**
574

A
Annie_wang 已提交
575 576 577 578 579
Invoke the system call again.

### 13900041 Disk Quota Exceeded

**Error Message**
580

A
Annie_wang 已提交
581 582 583
Quota exceeded

**Possible Causes**
584

A
Annie_wang 已提交
585 586 587
The disk space is insufficient.

**Solution**
588

A
Annie_wang 已提交
589 590 591 592 593
Clear disk space.

### 13900042 Unknown Error

**Error Message**
594

A
Annie_wang 已提交
595 596 597
Unknown error

**Possible Causes**
598

A
Annie_wang 已提交
599 600 601 602 603 604 605 606 607 608 609
The error is unidentified.

**Solution**
1. Call the API again.
2. Restart the service.

## User Data Management Error Codes

### 14000001 Invalid File Name

**Error Message**
610

A
Annie_wang 已提交
611 612 613
Invalid display name

**Possible Causes**
614

A
Annie_wang 已提交
615 616 617
The file name contains invalid characters.

**Solution**
618

A
Annie_wang 已提交
619 620 621 622 623
Modify the file name.

### 14000002 Invalid URI

**Error Message**
624

A
Annie_wang 已提交
625 626 627
Invalid uri

**Possible Causes**
628

A
Annie_wang 已提交
629 630 631
The URI is invalid.

**Solution**
632

A
Annie_wang 已提交
633 634 635 636 637
Use the obtained URI.

### 14000003 Invalid File Name Extension

**Error Message**
638

A
Annie_wang 已提交
639 640 641
Invalid file extension

**Possible Causes**
642

A
Annie_wang 已提交
643 644 645
The file name extension is incorrect.

**Solution**
646

A
Annie_wang 已提交
647 648 649 650 651
Modify the file name extension.

### 14000004 File in Recycle Bin

**Error Message**
652

A
Annie_wang 已提交
653 654 655
File has been put into trash bin

**Possible Causes**
656

A
Annie_wang 已提交
657 658 659
The file is moved to the Recycle Bin.

**Solution**
660

A
Annie_wang 已提交
661 662 663 664 665 666 667
Check whether the file is in the Recycle Bin.

## Spatial Statistics Error Codes

### 13600001 IPC Failed

**Error Message**
668

A
Annie_wang 已提交
669 670 671
IPC error

**Possible Causes**
672

A
Annie_wang 已提交
673 674 675
The called service does not exist.

**Solution**
676

A
Annie_wang 已提交
677 678 679 680 681
Check whether the service is started.

### 13600002 File System Not Supported

**Error Message**
682 683

Not supported file system
A
Annie_wang 已提交
684 685

**Possible Causes**
686

A
Annie_wang 已提交
687 688 689
The file system is not supported.

**Solution**
690

A
Annie_wang 已提交
691 692 693 694 695
Use a supported file system.

### 13600003 Mount Failed

**Error Message**
696

A
Annie_wang 已提交
697 698 699
Failed to mount

**Possible Causes**
700

A
Annie_wang 已提交
701 702 703
The **mount** command fails.

**Solution**
704

A
Annie_wang 已提交
705 706 707 708 709
Remove the card and run the **mount** command again.

### 13600004 Unmount Failed

**Error Message**
710

A
Annie_wang 已提交
711 712 713
Failed to unmount

**Possible Causes**
714

A
Annie_wang 已提交
715 716 717
The device does not respond.

**Solution**
718

A
Annie_wang 已提交
719 720 721 722 723
Check whether the file is being used. If yes, kill the thread that uses the file.

### 13600005 Incorrect Volume State

**Error Message**
724

A
Annie_wang 已提交
725 726 727
Incorrect volume state

**Possible Causes**
728

A
Annie_wang 已提交
729 730 731
The volume state is incorrect.

**Solution**
732

A
Annie_wang 已提交
733 734 735 736 737
Check whether the current volume state is correct.

### 13600006 Failed to Create a Directory or Node

**Error Message**
738

A
Annie_wang 已提交
739 740 741
Prepare directory or node error

**Possible Causes**
742

A
Annie_wang 已提交
743 744 745
The directory or node to be created already exists.

**Solution**
746

A
Annie_wang 已提交
747 748 749 750 751
Check whether the directory or node to be created already exists.

### 13600007 Failed to Delete a Directory or Node

**Error Message**
752

A
Annie_wang 已提交
753 754 755
Delete directory or node error

**Possible Causes**
756

A
Annie_wang 已提交
757 758 759
The specified directory or node has been deleted.

**Solution**
760

A
Annie_wang 已提交
761 762 763 764 765
Check whether the specified directory or node exists.

### 13600008 Object Not Exist

**Error Message**
766

A
Annie_wang 已提交
767 768 769 770 771 772 773 774 775 776 777 778 779
No such object

**Possible Causes**
1. The specified volume ID is incorrect.
2. The specified bundle name is incorrect.

**Solution**
1. Check whether the specified volume exists.
2. Check whether the specified bundle name exists.

### 13600009 Invalid User ID

**Error Message**
780

A
Annie_wang 已提交
781 782 783
User id out of range

**Possible Causes**
784

A
Annie_wang 已提交
785 786 787
The specified user ID is incorrect.

**Solution**
788

A
Annie_wang 已提交
789 790 791 792 793 794 795
Check that the user ID is correct.

## User File Access Error Codes

### 14300001 IPC Failed

**Error Message**
796

A
Annie_wang 已提交
797 798 799
IPC error

**Possible Causes**
800

A
Annie_wang 已提交
801 802 803 804
1. The server service does not exist.
2. The extension mechanism is abnormal.

**Solution**
805

A
Annie_wang 已提交
806 807 808 809 810
Check that the server service exists.

### 14300002 Incorrect URI Format

**Error Message**
811

A
Annie_wang 已提交
812 813 814
Invalid uri

**Possible Causes**
815

A
Annie_wang 已提交
816 817 818
The URI is invalid.

**Solution**
819

A
Annie_wang 已提交
820 821 822 823 824
Check that the URI is in correct format.

### 14300003 Failed to Obtain the Server Ability Information

**Error Message**
825

A
Annie_wang 已提交
826 827 828
Fail to get fileextension info

**Possible Causes**
829

A
Annie_wang 已提交
830 831 832
The BMS interface is abnormal.

**Solution**
833

A
Annie_wang 已提交
834 835 836 837 838
Check for basic system capability errors.

### 14300004 Incorrect Result Returned by js-server

**Error Message**
839

A
Annie_wang 已提交
840 841 842
Get wrong result

**Possible Causes**
843

A
Annie_wang 已提交
844 845 846
The data returned by the server is incorrect.

**Solution**
847

A
Annie_wang 已提交
848 849 850 851 852
Check the data returned by the server.

### 14300005 Failed to Register Notify

**Error Message**
853

A
Annie_wang 已提交
854 855 856 857 858 859 860
Fail to register notification

**Possible Causes**
1. The server service does not exist.
2. The extension mechanism is abnormal.

**Solution**
861

A
Annie_wang 已提交
862 863 864 865 866
Check that the server service exists.

### 14300006 Failed to Unregister Notify

**Error Message**
867

A
Annie_wang 已提交
868 869 870 871 872 873 874
Fail to remove notification

**Possible Causes**
1. The server service does not exist.
2. The extension mechanism is abnormal.

**Solution**
875

A
Annie_wang 已提交
876 877 878 879 880
Check that the server service exists.

### 14300007 Failed to Initialize the Notify Agent

**Error Message**
881

A
Annie_wang 已提交
882 883 884
Fail to init notification agent

**Possible Causes**
885

A
Annie_wang 已提交
886 887 888
The specified Notify agent has not been registered.

**Solution**
889

A
Annie_wang 已提交
890 891 892 893 894
Check whether the specified Notify agent is registered.

### 14300008 Failed to Notify the Agent

**Error Message**
895

A
Annie_wang 已提交
896 897 898 899 900 901 902
Fail to notify agent

**Possible Causes**
1. The service does not exist.
2. The extension mechanism is abnormal.

**Solution**
903

A
Annie_wang 已提交
904
Check whether the client is normal.
A
Annie_wang 已提交
905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942

## Error Code Adaptation
The APIs provided by the file management subsystem support exception handling.
Sample code for exception handling in a synchronous API:
```js
import fs from '@ohos.file.fs'

try {
    let file = fs.openSync(path, fs.OpenMode.READ_ONLY);
} catch (err) {
    console.error("openSync errCode:" + err.code + ", errMessage:" + err.message);
}
```
Sample code for exception handling in an asynchronous API (promise):
```js
import fs from '@ohos.file.fs'

try {
    let file = await fs.open(path, fs.OpenMode.READ_ONLY);
} catch (err) {
    console.error("open promise errCode:" + err.code + ", errMessage:" + err.message);
}
```

Sample code for exception handling in an asynchronous API (callback):
```js
import fs from '@ohos.file.fs'

try {
    fs.open(path, fs.OpenMode.READ_ONLY, function(e, file){ // Asynchronous thread (such as the system call) errors are obtained via a callback.
        if (e) {
            console.error("open in async errCode:" + e.code + ", errMessage:" + e.message);
        }
    });
} catch (err) {// Main thread errors (such as invalid parameters) are obtained by try catch.
    console.error("open callback errCode:" + err.code + ", errMessage:" + err.message);
}
```