diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 4b3071f..bd2ad8f 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -25,8 +25,15 @@ jobs: with: python-version: "3.11" - - name: Install Java and Node - run: sudo apt update && sudo apt install -y default-jdk nodejs npm git curl + # Nextflow 23.10 supports Java up to 21 + - name: Set up Java 21 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: "21" + + - name: Install Node + run: sudo apt update && sudo apt install -y nodejs npm git curl - name: Install vcf-validator and vcf-assembly-checker run: | diff --git a/eva_sub_cli/etc/eva_schema.json b/eva_sub_cli/etc/eva_schema.json index 8d4778f..e41b370 100644 --- a/eva_sub_cli/etc/eva_schema.json +++ b/eva_sub_cli/etc/eva_schema.json @@ -223,6 +223,11 @@ "type": "string", "description": "The path to the reference in fasta format that was used to create the VCF. (This is a local path)" }, + "referenceSequenceCollection": { + "type": "string", + "description": "GA4GH sequence collection top level digest of the reference fasta used for validation. This is calculated by eva-sub-cli and should not be provided.", + "pattern": "^[A-Za-z0-9_-]{32}$" + }, "assemblyReport": { "type": "string", "description": "The path to the assembly report associated with the assembly as found in NCBI assemblies. (This is a local path and only applicable for GCAs)" @@ -428,6 +433,48 @@ } } } + }, + "sequenceCollections": { + "type": "array", + "description": "GA4GH sequence collections of the reference fasta files used for validation. This is calculated by eva-sub-cli and should not be provided.", + "items": { + "type": "object", + "required": [ + "digest", + "names", + "lengths", + "sequences" + ], + "properties": { + "digest": { + "type": "string", + "description": "Top level digest of the sequence collection", + "pattern": "^[A-Za-z0-9_-]{32}$" + }, + "names": { + "type": "array", + "description": "Names of the sequences", + "items": { + "type": "string" + } + }, + "lengths": { + "type": "array", + "description": "Lengths of the sequences", + "items": { + "type": "integer" + } + }, + "sequences": { + "type": "array", + "description": "Refget digests of the sequences", + "items": { + "type": "string", + "pattern": "^SQ\\.[A-Za-z0-9_-]{32}$" + } + } + } + } } }, "definitions": { diff --git a/eva_sub_cli/executables/generate_sequence_collection.py b/eva_sub_cli/executables/generate_sequence_collection.py new file mode 100644 index 0000000..865dbf1 --- /dev/null +++ b/eva_sub_cli/executables/generate_sequence_collection.py @@ -0,0 +1,27 @@ +import argparse +import json + +from ebi_eva_common_pyutils.logger import logging_config + +from eva_sub_cli.seqcol import sequence_collection_from_fasta + +logger = logging_config.get_logger(__name__) + + +def main(): + arg_parser = argparse.ArgumentParser( + description='Calculate the GA4GH sequence collection (and its digest) of a FASTA file.') + arg_parser.add_argument('--input_fasta', required=True, dest='input_fasta', + help='Fasta file for which the sequence collection will be calculated') + arg_parser.add_argument('--output_json', required=True, dest='output_json', + help='Path to the JSON file where the sequence collection will be written') + args = arg_parser.parse_args() + logging_config.add_stdout_handler() + sequence_collection = sequence_collection_from_fasta(args.input_fasta) + logger.info(f'Sequence collection digest for {args.input_fasta}: {sequence_collection["digest"]}') + with open(args.output_json, 'w') as open_json: + json.dump(sequence_collection, open_json) + + +if __name__ == "__main__": + main() diff --git a/eva_sub_cli/metadata.py b/eva_sub_cli/metadata.py index c08f089..890dbf6 100644 --- a/eva_sub_cli/metadata.py +++ b/eva_sub_cli/metadata.py @@ -55,6 +55,14 @@ def set_analyses(self, analysis_list): assert isinstance(analysis_list, list) self.content['analysis'] = analysis_list + @property + def sequence_collections(self): + return self.content.get('sequenceCollections', []) + + def set_sequence_collections(self, sequence_collection_list): + assert isinstance(sequence_collection_list, list) + self.content['sequenceCollections'] = sequence_collection_list + @cached_property def samples_per_analysis(self): """Returns mapping of analysis alias to sample names, based on metadata.""" diff --git a/eva_sub_cli/nextflow/validation.nf b/eva_sub_cli/nextflow/validation.nf index 5989b99..a65268b 100644 --- a/eva_sub_cli/nextflow/validation.nf +++ b/eva_sub_cli/nextflow/validation.nf @@ -40,6 +40,7 @@ params.python_scripts = [ "samples_checker": "samples_checker.py", "evidence_type_checker": "evidence_type_checker.py", "fasta_checker": "check_fasta_insdc.py", + "sequence_collection": "generate_sequence_collection.py", "xlsx2json": "xlsx2json.py", "semantic_checker": "check_metadata_semantics.py", "trim_down": "trim_down.py", @@ -85,6 +86,8 @@ workflow { file(joinBasePath(row.fasta)), file(joinBasePath(row.report)) )} + // Sequence collection is calculated on the original (not trimmed down) fasta files + generate_sequence_collection(vcf_and_ref_ch.map{row -> row[1]}.unique()) if (params.shallow_validation) { // create a smaller vcf and fasta then replace the channel trim_down_vcf(vcf_and_ref_ch) @@ -253,6 +256,31 @@ process collect_file_size_and_md5 { } +/* +* Calculate the GA4GH sequence collection of the reference fasta +*/ +process generate_sequence_collection { + + label 'med_time', 'small_mem' + + publishDir output_dir, + overwrite: true, + mode: "copy" + + input: + path(fasta) + + output: + path "${fasta}_seqcol.json", emit: sequence_collection_json + path "${fasta}_seqcol.log", emit: sequence_collection_log + + script: + """ + $params.python_scripts.sequence_collection --input_fasta $fasta --output_json ${fasta}_seqcol.json > ${fasta}_seqcol.log 2>&1 + """ +} + + process convert_xlsx_2_json { label 'short_time', 'small_mem' diff --git a/eva_sub_cli/seqcol.py b/eva_sub_cli/seqcol.py new file mode 100644 index 0000000..09722e1 --- /dev/null +++ b/eva_sub_cli/seqcol.py @@ -0,0 +1,57 @@ +""" +Computation of GA4GH sequence collections (https://ga4gh.github.io/refget/seqcols/) from a FASTA file. +""" +import base64 +import hashlib +import json + +from eva_sub_cli.file_utils import fasta_iter + +# Attributes included in the level 2 representation of the sequence collection +SEQCOL_ATTRIBUTES = ('names', 'lengths', 'sequences') +# Attributes contributing to the top level (level 0) digest +INHERENT_ATTRIBUTES = ('names', 'sequences') + + +def sha512t24u_digest(data): + """GA4GH digest: base64url encoding of the first 24 bytes of the SHA-512 hash of the data.""" + if isinstance(data, str): + data = data.encode('utf-8') + return base64.urlsafe_b64encode(hashlib.sha512(data).digest()[:24]).decode('ascii') + + +def canonical_json(obj): + """ + Serialise to canonical JSON (RFC-8785). This implementation is sufficient for objects and arrays containing + strings and integers, which is all that the sequence collection attributes use. + """ + return json.dumps(obj, separators=(',', ':'), sort_keys=True, ensure_ascii=False, allow_nan=False).encode('utf-8') + + +def refget_sequence_digest(sequence): + """Refget v2 identifier of a sequence.""" + return 'SQ.' + sha512t24u_digest(sequence.upper()) + + +def level1_digests(collection): + """Digest of each attribute of a level 2 sequence collection.""" + return {attribute: sha512t24u_digest(canonical_json(collection[attribute])) for attribute in SEQCOL_ATTRIBUTES} + + +def level0_digest(level1): + """Top level digest of a sequence collection, computed from the level 1 digests of the inherent attributes.""" + return sha512t24u_digest(canonical_json({attribute: level1[attribute] for attribute in INHERENT_ATTRIBUTES})) + + +def sequence_collection_from_fasta(input_fasta): + """ + Calculate the sequence collection of a FASTA file. + :param input_fasta: path to the (optionally gzipped) FASTA file + :returns: dict with the level 0 digest and the level 2 attributes (names, lengths, sequences) + """ + collection = {attribute: [] for attribute in SEQCOL_ATTRIBUTES} + for header, sequence in fasta_iter(input_fasta): + collection['names'].append(header.split()[0]) + collection['lengths'].append(len(sequence)) + collection['sequences'].append(refget_sequence_digest(sequence)) + return {'digest': level0_digest(level1_digests(collection)), **collection} diff --git a/eva_sub_cli/validators/validator.py b/eva_sub_cli/validators/validator.py index 73ab0f2..ee219d8 100755 --- a/eva_sub_cli/validators/validator.py +++ b/eva_sub_cli/validators/validator.py @@ -1,6 +1,7 @@ #!/usr/bin/env python import csv import datetime +import json import logging import os import shutil @@ -527,6 +528,7 @@ def _collect_metadata_results(self): self._convert_biovalidator_validation_to_spreadsheet() self._write_spreadsheet_validation_results() file_info_file = self._collect_file_info_to_metadata() + self._collect_sequence_collections_to_metadata() self._add_schema_to_metadata() if not any([metadata_validation_file, metadata_semantic_file, file_info_file, @@ -706,6 +708,53 @@ def _collect_file_info_to_metadata(self): self.results[METADATA_CHECK]['json_errors'] = errors return md5sum_file + def _load_sequence_collections(self): + """Returns the sequence collections calculated for each fasta file, keyed by fasta file name.""" + sequence_collections = {} + for fasta_file in self.fasta_files: + fasta_name = os.path.basename(fasta_file) + seqcol_file = resolve_single_file_path( + os.path.join(self.output_dir, 'other_validations', f'{fasta_name}_seqcol.json')) + if not seqcol_file: + self.warning(f'Cannot locate the sequence collection for {fasta_name}. The process might have failed.') + continue + try: + with open(seqcol_file) as open_json: + sequence_collections[fasta_name] = json.load(open_json) + except ValueError as e: + self.warning(f'Cannot parse the sequence collection in {seqcol_file}: {e}') + return sequence_collections + + def _collect_sequence_collections_to_metadata(self): + """ + Attach the sequence collection digest of the reference fasta to each analysis and add the sequence + collections to the metadata. + This is not used for validation so failures are only logged. + """ + if not self.metadata_json_post_validation: + return + sequence_collections = self._load_sequence_collections() + metadata = EvaMetadataJson(self.metadata_json_post_validation) + try: + collections_per_digest = {} + for analysis in metadata.analyses: + if not analysis.get('referenceFasta'): + continue + sequence_collection = sequence_collections.get(os.path.basename(analysis['referenceFasta'])) + if not sequence_collection: + self.warning(f'No sequence collection found for analysis {analysis.get("analysisAlias")}') + continue + analysis['referenceSequenceCollection'] = sequence_collection['digest'] + collections_per_digest[sequence_collection['digest']] = sequence_collection + if not collections_per_digest: + return + metadata.set_analyses(metadata.analyses) + metadata.set_sequence_collections(list(collections_per_digest.values())) + except Exception as e: + self.warning('Error while adding sequence collections to the metadata json: ' + str(e)) + return + metadata.write(self.metadata_json_post_validation) + def _add_schema_to_metadata(self): if self.metadata_json_post_validation: metadata = EvaMetadataJson(self.metadata_json_post_validation) diff --git a/pyproject.toml b/pyproject.toml index 86a8ac4..d0b4c0d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,6 +32,7 @@ classifiers = [ [project.scripts] 'eva-sub-cli.py'='eva_sub_cli.executables.cli:main' 'check_fasta_insdc.py'='eva_sub_cli.executables.check_fasta_insdc:main' +'generate_sequence_collection.py'='eva_sub_cli.executables.generate_sequence_collection:main' 'check_metadata_semantics.py'='eva_sub_cli.executables.check_metadata_semantics:main' 'samples_checker.py'='eva_sub_cli.executables.samples_checker:main' 'evidence_type_checker.py'='eva_sub_cli.executables.evidence_type_checker:main' diff --git a/tests/resources/seqcol/base.fa b/tests/resources/seqcol/base.fa new file mode 100644 index 0000000..dd08063 --- /dev/null +++ b/tests/resources/seqcol/base.fa @@ -0,0 +1,6 @@ +>chrX +TTGGGGAA +>chr1 +GGAA +>chr2 +GCGC diff --git a/tests/resources/seqcol/different_names.fa b/tests/resources/seqcol/different_names.fa new file mode 100644 index 0000000..0358591 --- /dev/null +++ b/tests/resources/seqcol/different_names.fa @@ -0,0 +1,6 @@ +>X +TTGGGGAA +>1 +GGAA +>2 +GCGC diff --git a/tests/resources/seqcol/different_order.fa b/tests/resources/seqcol/different_order.fa new file mode 100644 index 0000000..2a462d4 --- /dev/null +++ b/tests/resources/seqcol/different_order.fa @@ -0,0 +1,6 @@ +>chr1 +GGAA +>chr2 +GCGC +>chrX +TTGGGGAA diff --git a/tests/resources/seqcol/expected_digests.json b/tests/resources/seqcol/expected_digests.json new file mode 100644 index 0000000..0b361f9 --- /dev/null +++ b/tests/resources/seqcol/expected_digests.json @@ -0,0 +1,102 @@ +{ + "base.fa": { + "digest": "XZlrcEGi6mlopZ2uD8ObHkQB1d0oDwKk", + "level1": { + "names": "Fw1r9eRxfOZD98KKrhlYQNEdSRHoVxAG", + "lengths": "cGRMZIb3AVgkcAfNv39RN7hnT5Chk7RX", + "sequences": "0uDQVLuHaOZi1u76LjV__yrVUIz9Bwhr" + }, + "level2": { + "names": [ + "chrX", + "chr1", + "chr2" + ], + "lengths": [ + 8, + 4, + 4 + ], + "sequences": [ + "SQ.iYtREV555dUFKg2_agSJW6suquUyPpMw", + "SQ.YBbVX0dLKG1ieEDCiMmkrTZFt_Z5Vdaj", + "SQ.AcLxtBuKEPk_7PGE_H4dGElwZHCujwH6" + ] + } + }, + "different_names.fa": { + "digest": "QvT5tAQ0B8Vkxd-qFftlzEk2QyfPtgOv", + "level1": { + "names": "lrCv6NNXom7AC9tKFWqhcLLZsrcgJIqq", + "lengths": "cGRMZIb3AVgkcAfNv39RN7hnT5Chk7RX", + "sequences": "0uDQVLuHaOZi1u76LjV__yrVUIz9Bwhr" + }, + "level2": { + "names": [ + "X", + "1", + "2" + ], + "lengths": [ + 8, + 4, + 4 + ], + "sequences": [ + "SQ.iYtREV555dUFKg2_agSJW6suquUyPpMw", + "SQ.YBbVX0dLKG1ieEDCiMmkrTZFt_Z5Vdaj", + "SQ.AcLxtBuKEPk_7PGE_H4dGElwZHCujwH6" + ] + } + }, + "different_order.fa": { + "digest": "Tpdsg75D4GKCGEHtIiDSL9Zx-DSuX5V8", + "level1": { + "names": "dOAOfPGkf3wAf3CUsbjVTKhY9Wq2DL6f", + "lengths": "x5qpE4FtMkvlwpKIzvHs3a02Nex5tthp", + "sequences": "7t6Ulz6OeUWu6FBxntbvFKOl8w3icl2h" + }, + "level2": { + "names": [ + "chr1", + "chr2", + "chrX" + ], + "lengths": [ + 4, + 4, + 8 + ], + "sequences": [ + "SQ.YBbVX0dLKG1ieEDCiMmkrTZFt_Z5Vdaj", + "SQ.AcLxtBuKEPk_7PGE_H4dGElwZHCujwH6", + "SQ.iYtREV555dUFKg2_agSJW6suquUyPpMw" + ] + } + }, + "pair_swap.fa": { + "digest": "UNGAdNDmBbQbHihecPPFxwTydTcdFKxL", + "level1": { + "names": "gSWbV6khfIsnlQTyw1PmlQ8G7VRfIWbU", + "lengths": "cGRMZIb3AVgkcAfNv39RN7hnT5Chk7RX", + "sequences": "0uDQVLuHaOZi1u76LjV__yrVUIz9Bwhr" + }, + "level2": { + "names": [ + "chr2", + "chr1", + "chrX" + ], + "lengths": [ + 8, + 4, + 4 + ], + "sequences": [ + "SQ.iYtREV555dUFKg2_agSJW6suquUyPpMw", + "SQ.YBbVX0dLKG1ieEDCiMmkrTZFt_Z5Vdaj", + "SQ.AcLxtBuKEPk_7PGE_H4dGElwZHCujwH6" + ] + } + } +} \ No newline at end of file diff --git a/tests/resources/seqcol/pair_swap.fa b/tests/resources/seqcol/pair_swap.fa new file mode 100644 index 0000000..51ceaad --- /dev/null +++ b/tests/resources/seqcol/pair_swap.fa @@ -0,0 +1,6 @@ +>chr2 +TTGGGGAA +>chr1 +GGAA +>chrX +GCGC diff --git a/tests/resources/validation_reports/validation_output/other_validations/input_passed.fa_seqcol.json b/tests/resources/validation_reports/validation_output/other_validations/input_passed.fa_seqcol.json new file mode 100644 index 0000000..da94eb0 --- /dev/null +++ b/tests/resources/validation_reports/validation_output/other_validations/input_passed.fa_seqcol.json @@ -0,0 +1 @@ +{"digest": "TgdJYLMYo2VuTkSSSdAP8HTM0PYXzJ8f", "names": ["chr1"], "lengths": [59940], "sequences": ["SQ.vNo95y6NDASFUcn0YTKIzX1LmIxXbK7i"]} \ No newline at end of file diff --git a/tests/test_seqcol.py b/tests/test_seqcol.py new file mode 100644 index 0000000..eb20f5f --- /dev/null +++ b/tests/test_seqcol.py @@ -0,0 +1,43 @@ +import json +import os +from tempfile import TemporaryDirectory +from unittest import TestCase + +from eva_sub_cli.seqcol import sha512t24u_digest, canonical_json, sequence_collection_from_fasta, level1_digests, \ + refget_sequence_digest + + +class TestSeqcol(TestCase): + resource_dir = os.path.join(os.path.dirname(__file__), 'resources', 'seqcol') + + def setUp(self): + # Expected digests come from the GA4GH refget test suite (refgenie/refget test_fasta/test_fasta_digests.json) + with open(os.path.join(self.resource_dir, 'expected_digests.json')) as open_json: + self.expected = json.load(open_json) + + def test_sha512t24u_digest(self): + assert sha512t24u_digest(b'') == 'z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXc' + assert sha512t24u_digest('ACGT') == 'aKF498dAxcJAqme6QYQ7EZ07-fiw8Kw2' + + def test_canonical_json(self): + assert canonical_json(['chr1', 'chr2']) == b'["chr1","chr2"]' + assert canonical_json([8, 4]) == b'[8,4]' + assert canonical_json({'sequences': 'b', 'names': 'a'}) == b'{"names":"a","sequences":"b"}' + + def test_refget_sequence_digest_case_insensitive(self): + assert refget_sequence_digest('acgt') == refget_sequence_digest('ACGT') == 'SQ.aKF498dAxcJAqme6QYQ7EZ07-fiw8Kw2' + + def test_sequence_collection_from_fasta(self): + for fasta_name, expected in self.expected.items(): + collection = sequence_collection_from_fasta(os.path.join(self.resource_dir, fasta_name)) + assert collection['digest'] == expected['digest'], fasta_name + assert level1_digests(collection) == expected['level1'], fasta_name + assert {k: collection[k] for k in expected['level2']} == expected['level2'], fasta_name + + def test_sequence_collection_lowercase_and_multiline_fasta(self): + with TemporaryDirectory() as tmp_dir: + fasta = os.path.join(tmp_dir, 'lower.fa') + with open(fasta, 'w') as open_file: + open_file.write('>chrX description\nttgg\nggaa\n>chr1\nggaa\n>chr2\ngcgc\n') + collection = sequence_collection_from_fasta(fasta) + assert collection['digest'] == self.expected['base.fa']['digest'] diff --git a/tests/test_validator.py b/tests/test_validator.py index 7819c59..7960abe 100644 --- a/tests/test_validator.py +++ b/tests/test_validator.py @@ -1,12 +1,15 @@ +import json import os.path import shutil from copy import deepcopy from tempfile import TemporaryDirectory from unittest import TestCase +import jsonschema import yaml import eva_sub_cli +from eva_sub_cli import ETC_DIR from eva_sub_cli.metadata import EvaMetadataJson from eva_sub_cli.validators.validator import (Validator, VALIDATION_OUTPUT_DIR, VCF_CHECK, ASSEMBLY_CHECK, READY_FOR_SUBMISSION_TO_EVA, @@ -756,6 +759,66 @@ def test__collect_file_info_to_metadata_missing_metadata_json(self): validator._assess_validation_results() assert validator.results[METADATA_CHECK][PASS] is False + def _create_metadata_with_reference_fasta(self, submission_dir, reference_fastas): + with open(self.metadata_json_file) as open_json: + content = json.load(open_json) + analysis_template = content['analysis'][0] + content['analysis'] = [] + for i, reference_fasta in enumerate(reference_fastas): + analysis = dict(analysis_template, analysisAlias=f'A{i}', referenceFasta=reference_fasta) + content['analysis'].append(analysis) + metadata_json = os.path.join(submission_dir, 'metadata_with_fasta.json') + with open(metadata_json, 'w') as open_json: + json.dump(content, open_json) + return metadata_json + + def test__collect_sequence_collections_to_metadata(self): + expected_digest = 'TgdJYLMYo2VuTkSSSdAP8HTM0PYXzJ8f' + with TemporaryDirectory() as submission_dir: + fasta = os.path.join(self.fasta_files, 'input_passed.fa') + # Two analyses sharing the same fasta (one relative path) and one analysis without fasta + metadata_json = self._create_metadata_with_reference_fasta( + submission_dir, [fasta, os.path.relpath(fasta), None]) + validator = self.create_validator_with_copied_output(submission_dir, metadata_json=metadata_json) + validator._collect_validation_workflow_results() + + metadata = EvaMetadataJson(metadata_json) + assert [a.get('referenceSequenceCollection') for a in metadata.analyses] == [ + expected_digest, expected_digest, None] + assert metadata.sequence_collections == [{ + 'digest': expected_digest, 'names': ['chr1'], 'lengths': [59940], + 'sequences': ['SQ.vNo95y6NDASFUcn0YTKIzX1LmIxXbK7i'] + }] + + def test__collect_sequence_collections_to_metadata_missing_seqcol(self): + with TemporaryDirectory() as submission_dir: + metadata_json = self._create_metadata_with_reference_fasta( + submission_dir, [os.path.join(self.fasta_files, 'input_passed.fa')]) + validator = self.create_validator_with_copied_output(submission_dir, metadata_json=metadata_json) + os.remove(os.path.join(validator.output_dir, 'other_validations', 'input_passed.fa_seqcol.json')) + validator._collect_validation_workflow_results() + json_errors = validator.results[METADATA_CHECK]['json_errors'] + + metadata = EvaMetadataJson(metadata_json) + assert 'referenceSequenceCollection' not in metadata.analyses[0] + assert 'sequenceCollections' not in metadata.content + # Not reported to the user + assert not any('sequence collection' in error['description'].lower() for error in json_errors) + + def test_metadata_with_sequence_collections_is_valid_against_schema(self): + with TemporaryDirectory() as submission_dir: + metadata_json = self._create_metadata_with_reference_fasta( + submission_dir, [os.path.join(self.fasta_files, 'input_passed.fa')]) + validator = self.create_validator_with_copied_output(submission_dir, metadata_json=metadata_json) + validator._collect_validation_workflow_results() + with open(os.path.join(ETC_DIR, 'eva_schema.json')) as open_json: + schema = json.load(open_json) + metadata = EvaMetadataJson(metadata_json) + analysis_schema = schema['properties']['analysis']['items']['properties'] + jsonschema.validate(metadata.analyses[0]['referenceSequenceCollection'], + analysis_schema['referenceSequenceCollection']) + jsonschema.validate(metadata.sequence_collections, schema['properties']['sequenceCollections']) + def test_collect_biovalidator_validation_results_missing_report(self): # Test for a nextflow run that did not complete and never produced metadata_validation.txt, # but other metadata check outputs are present -> task should not crash, only a dummy error