Error messages reference¶
Every message API Maker answers comes from a template with a code. The codes matter for two things : you recognise a problem quickly, and you can translate any template per caller with internationalization (the key x-am-internationalization). The {field}, {value}… placeholders are filled with the details of the request.
Data and schema¶
| Code | Message | When |
|---|---|---|
| AM_00001 | Please provide valid '{field}' field with type '{type}'. | A required field is missing or has the wrong type. Also the version field of optimistic concurrency control missing on an update. |
| AM_00002 | Please provide minimum '{value}' for '{field}' field. | validations.min |
| AM_00003 | Please provide maximum '{value}' for '{field}' field. | validations.max |
| AM_00004 | Property '{field}' should have minimum length of '{value}'. | validations.minLength |
| AM_00005 | Property '{field}' should have maximum length of '{value}'. | validations.maxLength |
| AM_00006 | Please provide unique value '{value}' for key '{field}' in data index '{dataIndex}'. | The same value twice in one save for a field with validations.unique. |
| AM_00007, AM_00008 | Please provide unique combination for keys ['{validationPath}'] in data index '{dataIndex}'. | The same combination twice in one save. |
| AM_00009, AM_00020 | {field} should be array as it is logical operator. | $and, $or, $nor with something else than an array. |
| AM_00010 | {field} should be array in schema as data is in array. | An array sent for a field the schema declares as a single value. |
| AM_00011, AM_00013, AM_00014 | '{value}' is not a valid number for key '{field}'. | A value which can not become the number the schema asks. |
| AM_00015, AM_00016 | Invalid date in '{field}' field. | A value which can not become a date. |
| AM_00017, AM_00018, AM_00019 | Invalid objectId in '{field}' field. | An object, an array or a bad string for an objectId field. |
| AM_00021, AM_00022 | Invalid date in min / max field in schema validation for '{field}' field. | The schema itself has a bad min or max date. |
| AM_00023, AM_00024 | Array is expected in key '{field}'. | $in and $nin need an array, and not an empty one for some operators. |
| AM_00058 | Found empty schema to validate. | A validation asked with no schema. |
| AM_00061 | Invalid data found for saving. Please provide data in JSON object format to save. | The body of a save is not an object or an array of objects. |
| AM_00062, AM_00112 | Type of '{field}' should be array in schema. | Array operations or an array value on a field which is not an array in the schema. |
| AM_00087 | Please provide valid value in {field}. | A validatorFun returned a falsy value. A thrown error uses its own message instead. |
| AM_00101 | {message} | Any message thrown by your code (validatorFun, conversionFun, custom API), passed through i18n. |
| AM_00111 | Property '{field}' should be valid email address. | validations.email |
| AM_00114 | [{field}] is duplicate having value [{value}]. | A duplicate the database refused (unique index). |
| AM_00116 | Property '{field}' should have any value from {value}. | validations.enum |
| AM_00117 | Concurrency version mismatch in '{field}'. This row/document is already updated. | The version sent is not the one of the row : optimistic concurrency control. |
| AM_00118 | Virtual field can not be used in find join feature. '{field}' is virtual field. | A find on a virtual field. |
| AM_00119 | Record not found. | throwErrorIfRecordNotFound=true and no row for the id. |
Query, deep populate and find join¶
| Code | Message | When |
|---|---|---|
| AM_00012 | Please provide id param value | Get by id, update by id, remove by id without an id. |
| AM_00036 | Please provide t_col value. | A deep item without t_col, and no relation in the schema for its s_key. |
| AM_00037 | Unable to find collection for s_key:'{field}', You can provide it in schema or deep by 't_col' property. | Same, for a nested level. |
| AM_00039 | Unable to find collection with name '{collectionName}' on path '{instanceName} -> {databaseName} -> {collectionName}'. | A t_col which does not exist. |
| AM_00040 | Unable to find primary key for target collection '{collectionName}'… | The target has no primary key and the deep item has no t_key. |
| AM_00044 | Please provide array for aggregate body. | The aggregate API needs a pipeline array. |
| AM_00045, AM_00047 | Please provide field for distinct API. You can also provide multiple fields separated by comma. | Distinct without a field. |
| AM_00046, AM_00048 | Invalid column ['{field}'] found in your field list. | select or distinct with a column the schema does not have. |
| AM_00049 | Please provide 'find' property having query to remove data. | Remove by query without find : nothing is ever deleted without a filter. |
| AM_00051 | Primary key '{field}' not found in schema. | The primaryKey param names a column which is not in the schema. |
| AM_00052, AM_00053 | Unable to convert '{value}' to number / objectId based on your schema type. | An id which does not fit the type of the primary key. |
| AM_00054, AM_00055 | Invalid primary key type '{type}' found for '{field}'. / Primary key not found in '{instanceName}' -> '{databaseName}' -> '{collectionName}'. | The table has no usable primary key. |
| AM_00056 | Schema is not defined for this collection '{collectionName}'. You can define schema or please try /api/gen version of the api. | A schema API called on a table without a schema. |
| AM_00060 | find property should be string of valid JSON/JSON5. | A find query param which does not parse. |
| AM_00063, AM_00066, AM_00067 | Unable to find schema / property '{field}' in schema of '{instanceName}' ➞ '{databaseName}' ➞ '{collectionName}'. | A deep or find join reaching a key or a table without a schema (schema APIs). |
| AM_00085 | $in/$nin operator value must be non empty array. | |
| AM_00086 | $gt/$gte/$lt/$lte value should be valid [string, number, date (iso format)]. | |
| AM_00110 | Multiple operators [{value}] are not supported in SQL databases at this moment. You can use $and operator to achieve that. | Several operators on one field on a SQL instance : wrap them in $and. |
| AM_00042, AM_00064, AM_00095 | This API is only supported for mongodb. / This API is not supported. / Replace by id API is not supported for instance type '{type}'. | Aggregate, array operations and replace by id on a SQL instance. |
Tokens and access¶
| Code | Message | When |
|---|---|---|
| AM_00034 | User '{name}' with username '{username}' is not having access to this API '{url}'. | No group of the API user grants the API : 403. |
| AM_00035 | Authorization header 'x-am-authorization' is not valid. | Bad or expired API user token : 401. |
| AM_00050 | User '{name}' does not have access to fields [{field}]. | A write to a field the group can not write. |
| AM_00084, AM_00115 | Invalid access token. / Invalid JWT token provided. | A token which does not verify. |
| AM_00090 | Please provide token request with ['u', 'p'] or ['refresh_token']. | The token API body is incomplete. |
| AM_00092, AM_00093 | Please provide '{name}' token in request headers. / Invalid token provided in '{name}' header. | The table asks for a person token which is missing or invalid. |
| AM_00094 | Token user not found in '{instanceName}' -> '{databaseName}' -> '{collectionName}'. | The person of the token is no longer in the users table. |
| AM_00105 | Multiple entries exists for this username '{value}' in database collection | table. |
| AM_00109 | Access groups not assigned to user. | The person has no group in the groups column. |
| AM_00113 | You are not authorized to access this API. | Generic refusal. |
| AM_00032 | Invalid request origin. You can give access to this host '{origin}' from settings. | The browser origin is not in the allowed origins of the sandbox settings. |
Secrets, encryption and payloads¶
| Code | Message | When |
|---|---|---|
| AM_00025 | Header '{header}' is required because of encryption used in key '{field}'. | |
| AM_00026 | Unable to find valid algorithm named '{algorithm}' for '{field}' field. These are valid encryption algorithms ['AES', 'RC4', 'TRIPLEDES']. | |
| AM_00027, AM_00029 | Unable to find encryption algorithm / secret for '{field}' field. You can provide its value in 'common.encryptionAlgorithm' & 'common.secret' key. | The default secret lacks the keys a field with encryption: true needs. |
| AM_00028, AM_00030 | Unable to find hashing algorithm / nonce for '{field}' field. | Same for hashing: true. |
| AM_00059, AM_00088 | Secret with id '{value}' is not present in the system. / Provided secret id '{value}' is not valid. | A bad x-am-secret header. |
| AM_00103, AM_00104, AM_00106, AM_00107, AM_00108 | Unable to decrypt data of 'dataEncFE' field. / Payload expired. / Please provide field 'createdAt'… | An encrypted payload which does not decrypt, is too old, or lacks createdAt. |
| AM_00068 | Invalid request. Please provide valid value for header x-am-code-hash. |
Instances, custom code and files¶
| Code | Message | When |
|---|---|---|
| AM_00031 | Instance with name '{instanceName}' does not exist. | |
| AM_00057, AM_00099 | Path '{url}' does not exist. / Please provide valid API path. Can not find any user with path '{value}'. | A wrong user path or custom API path : 404. |
| AM_00065 | Unsupported value found for parameter '{field}' | |
| AM_00069, AM_00070, AM_00071, AM_00072 | Migration script … not found / Execution is locked … | Database migrations |
| AM_00073, AM_00074 | Unable to find custom API with name '{name}'. / … version '{versionNumber}' … | A g.sys.system.callExternalApi or a test naming a custom API which is not there. |
| AM_00075, AM_00076 | Unable to find scheduler … | |
| AM_00077 | Unable to find version '{versionNumber}' in schema of … | |
| AM_00078, AM_00079 | Unable to find store API … | Third party APIs |
| AM_00081, AM_00082 | Unable to find utility class with name '{name}'. / … version … | An import * as x from 'utils/X' of a class which does not exist. |
| AM_00096 | Unable to find system API with name '{name}'. | |
| AM_00097, AM_00098 | Please provide 'path' property. / Please provide request body. | |
| AM_00100 | WebSocket event not found with name '{name}'. You can create this event in API Info → WebSocket Events. | emitEventWS with an unknown event. |
| AM_00120 | File upload is not supported in [{name}] API. | |
| AM_00121, AM_00122 | Minimum / Maximum file size supported is '{value}' bytes and you provided [{name}] file with '{value2}' bytes in '{field}' field. | Custom API file uploads |
| AM_00123 | Allowed extensions are [{value}] and you provided file '{name}' with extension '{value2}'. | |
| AM_00124 | Allowed fields are [{value}] and you have provided value in field '{field}'. | |
| AM_00125 | Please provide ['oracleDBUsername', 'oracleDBPassword', 'oracleDBPrivilege']. | An Oracle instance without its credentials. |
Translating them¶
Open Utility → i18N Management, create a language, and change the value of any code. Send the name of the language in x-am-internationalization and every message of the reply follows it. Your own messages (custom API errorList, thrown strings) can be mapped too. See Internationalization.