apache/superset · error · ValidationError
Not a valid YAML file
Error message
Not a valid YAML file
What it means
Error "Not a valid YAML file" thrown in apache/superset.
Source
Thrown at superset/commands/importers/v1/utils.py:64
"""Remove the first directory of a path"""
full_path = PurePosixPath(file_path)
relative_path = PurePosixPath(*full_path.parts[1:])
return str(relative_path)
class MetadataSchema(Schema):
version = fields.String(required=True, validate=validate.Equal(IMPORT_VERSION))
type = fields.String(required=False)
timestamp = fields.DateTime()
def load_yaml(file_name: str, content: str) -> dict[str, Any]:
"""Try to load a YAML file"""
try:
return yaml.safe_load(content)
except yaml.YAMLError as ex:
logger.exception("Invalid YAML in %s", file_name)
raise ValidationError({file_name: "Not a valid YAML file"}) from ex
def load_metadata(contents: dict[str, str]) -> dict[str, str]:
"""Apply validation and load a metadata file"""
if METADATA_FILE_NAME not in contents:
# if the contents have no METADATA_FILE_NAME this is probably
# a original export without versioning that should not be
# handled by this command
raise IncorrectVersionError(f"Missing {METADATA_FILE_NAME}")
metadata = load_yaml(METADATA_FILE_NAME, contents[METADATA_FILE_NAME])
try:
MetadataSchema().load(metadata)
except ValidationError as ex:
# if the version doesn't match raise an exception so that the
# dispatcher can try a different command version
if "version" in ex.messages:
raise IncorrectVersionError(ex.messages["version"][0]) from exView on GitHub (pinned to f4587218dd)
Solutions
- Ensure the file is valid YAML with a .yaml/.yml extension.
- Validate the YAML syntax with a linter before uploading.
When it happens
Trigger: An uploaded import file cannot be parsed as YAML.
Common situations: Importing assets from an uploaded file whose contents are not parseable YAML.
AI-assisted analysis of apache/superset@f4587218dd (2026-08-14).
Data as JSON: /api/errors/e36f28c5195aa92e.
Report an issue: GitHub.