Skip to main content

Troubleshooting

This page details some of the common errors reported by the CLI tool and provides best practice advice to prevent these errors from occurring.

Common errors
Link copied!

The format of errors is as follows. A request may result in multiple errors:

Error: Request failed with status code 400: {"errors":[{"level":"ERROR","code":"CONTENT_TYPE_INVALID","message":"should NOT be longer than 1 characters","property":"FATAL","entity":"ContentTypeValidation","invalidValue":"/title"}

Some of the common errors are shown below.

Error codeDescription
CONTENT_TYPE_INVALIDThis is a validation error. Validation errors often also include the error message: should NOT have more than [X] items or the error entity: ContentTypeValidation.
CONTENT_ITEM_UNABLE_TO_EXECUTE_FACETSThis is a bulk action error. Bulk action errors may also include the error message: Unable to perform faceting.

Validation errors
Link copied!

A validation error occurs when your content is not valid according to the parameters outlined in your schema.

When creating content, validation parameters are defined in the content type schema to limit the inputs of certain fields. In the title property below, we have set the minimum text length to 1 and the maximum text length to 150 characters.

    "type": "object",
"properties": {
"title": {
"title": "Title",
"description": "Used for heading and SEO title tag",
"type": "string",
"minLength": 1,
"maxLength": 150
}

If you changed the maxLength of the title property to 100 characters, any existing content with titles that exceed that length would no longer be valid. This will include content that you've already exported that was created using an earlier version of this schema.

How to check for invalid content items
Link copied!

When running a hub clone or content item copy command, you can specify the --validate option. This will validate the content and create the folder structure but not import the content. You can then fix any validation errors and run the command without the —validate option.

Preventing validation errors
Link copied!

In order to prevent a validation issue from occurring, the best practice is to ensure all the content in your hub follows the parameters outlined in the schema. It is best to do this before attempting to perform a copy or clone action in the CLI tool. Validation errors will usually enable you to identify invalid content. You can then update your schema validation or modify the content so that it passes validation.

For more information about validation parameters, please visit the validation page.

Validation error examples
Link copied!

Below you'll find an example of a validation error when a clone is run with and without the --validate command.

Validation error when run with validate option
Link copied!

In the error below, we have received a warning that one of our blogs does not validate under the available schema and may not import correctly. The --validate option allows us to identity the content items that do not pass validation.

WARNING: Baby blog does not validate under the available schema. It may not import correctly.
[
{
"keyword": "maxLength",
"dataPath": ".title",
"schemaPath": "#/properties/title/maxLength",
"params": {
"limit": 1
},
"message": "should NOT be longer than 1 characters"
}
]
/Users/kojogbede/.amplience/copy-1686576065200/Content/Baby blog.json
/Users/kojogbede/.amplience/copy-1686576065200/Content/Babywear text.json
/Users/kojogbede/.amplience/copy-1686576065200/Content/Babywear image.json
/Users/kojogbede/.amplience/copy-1686576065200/Content/Babywear author.json
/Users/kojogbede/.amplience/copy-1686576065200/Content/Winter banner.json
/Users/kojogbede/.amplience/copy-1686576065200/Content/Summer banner.json
=== Importing to destination... ===
Existing mapping loaded from '/Users/kojogbede/.amplience/clone/hub-6452aa021a8f3574f598716f.json', changes will be saved back to it.
Scanning structure and content in '/Users/kojogbede/.amplience/copy-1686576065200/Content' for repository 'Content'...
Scanning structure and content in '/Users/kojogbede/.amplience/copy-1686576065200/Examples' for repository 'Examples'...
Scanning structure and content in '/Users/kojogbede/.amplience/copy-1686576065200/Slots' for repository 'Slots'...
Done. Validating content...
2 of the items being imported already exist in the mapping. Would you like to update these content items instead of skipping them? (y/n) y
Found 2 dependancy levels in 6 items, 0 referencing a circular dependancy.
Importing 6 content items...
--validate was passed, so no content was imported.
=== Done! ===

Validation error when run without validate command
Link copied!

The error below shows the output of a clone when some invalid content is encountered and the --validate option is not specified. The clone command fails with an error and a validation error is shown.

WARNING: Baby blog does not validate under the available schema. It may not import correctly.
[
{
"keyword": "maxLength",
"dataPath": ".title",
"schemaPath": "#/properties/title/maxLength",
"params": {
"limit": 1
},
"message": "should NOT be longer than 1 characters"
}
]
/Users/kojogbede/.amplience/copy-1686576382735/Content/Baby blog.json
/Users/kojogbede/.amplience/copy-1686576382735/Content/Babywear text.json
/Users/kojogbede/.amplience/copy-1686576382735/Content/Babywear image.json
/Users/kojogbede/.amplience/copy-1686576382735/Content/Babywear author.json
/Users/kojogbede/.amplience/copy-1686576382735/Content/Winter banner.json
/Users/kojogbede/.amplience/copy-1686576382735/Content/Summer banner.json
=== Importing to destination... ===
Existing mapping loaded from '/Users/kojogbede/.amplience/clone/hub-6452aa021a8f3574f598716f.json', changes will be saved back to it.
Scanning structure and content in '/Users/kojogbede/.amplience/copy-1686576382735/Content' for repository 'Content'...
Scanning structure and content in '/Users/kojogbede/.amplience/copy-1686576382735/Examples' for repository 'Examples'...
Scanning structure and content in '/Users/kojogbede/.amplience/copy-1686576382735/Slots' for repository 'Slots'...
Done. Validating content...
2 of the items being imported already exist in the mapping. Would you like to update these content items instead of skipping them? (y/n) y
Found 2 dependancy levels in 6 items, 0 referencing a circular dependancy.
Importing 6 content items...
ERROR: Failed creating Baby blog:
Error: Request failed with status code 400: {"errors":[{"level":"ERROR","code":"CONTENT_TYPE_INVALID","message":"should NOT be longer than 1 characters","property":"FATAL","entity":"ContentTypeValidation","invalidValue":"/title"},{"level":"ERROR","code":"CONTENT_TYPE_INVALID","message":"should be <= 5","property":"FATAL","entity":"ContentTypeValidation","invalidValue":"/ranking"},{"level":"ERROR","code":"CONTENT_TYPE_INVALID","message":"should NOT be longer than 2 characters","property":"FATAL","entity":"ContentTypeValidation","invalidValue":"/description"}]}
Importing content item failed, aborting. Error: Error: Request failed with status code 400: {"errors":[{"level":"ERROR","code":"CONTENT_TYPE_INVALID","message":"should NOT be longer than 1 characters","property":"FATAL","entity":"ContentTypeValidation","invalidValue":"/title"},{"level":"ERROR","code":"CONTENT_TYPE_INVALID","message":"should be <= 5","property":"FATAL","entity":"ContentTypeValidation","invalidValue":"/ranking"},{"level":"ERROR","code":"CONTENT_TYPE_INVALID","message":"should NOT be longer than 2 characters","property":"FATAL","entity":"ContentTypeValidation","invalidValue":"/description"}]}
Step 5 ('content': Clone Content) Failed. Terminating.

To continue the clone from this point, use the option:
--step content

note

The --force option is particularly useful if you are combining multiple commands into scripts that you want to run unattended. This option will ignore any warnings and not wait for any prompts so the script can run without any user input. It is recommended that you use --validate to identify any problems before running scripts that use the --force option.

Bulk action errors
Link copied!

Another kind of error you may encounter could be a bulk action error. These kinds of errors occur when the task you're trying to perform includes actions on too many pieces of content.

Preventing bulk action errors
Link copied!

A solution to bulk action errors would be to break down your processes into smaller tasks so as to not overload the CLI tool's capability.

Bulk action error examples
Link copied!

Bulk action errors usually include the code "CONTENT_ITEM_UNABLE_TO_EXECUTE_FACETS which indicates the ClI tool's inability to deal with a large amount of content. Similar to validation errors, these errors may also have a status code of 400.

{
"data": {
"errors": [
{
"level": "ERROR",
"code": "CONTENT_ITEM_UNABLE_TO_EXECUTE_FACETS",
"message": "Unable to perform faceting."
}
]
},
"status": 400
}

Dynamic Content CLI tool on GitHub