diff --git a/python_modules/dagster/dagster/_core/definitions/decorators/decorator_assets_definition_builder.py b/python_modules/dagster/dagster/_core/definitions/decorators/decorator_assets_definition_builder.py index ce6e715399b35..2f3d96a2365d0 100644 --- a/python_modules/dagster/dagster/_core/definitions/decorators/decorator_assets_definition_builder.py +++ b/python_modules/dagster/dagster/_core/definitions/decorators/decorator_assets_definition_builder.py @@ -44,7 +44,7 @@ from dagster._core.types.dagster_type import DagsterType, Nothing from ..asset_check_spec import AssetCheckSpec -from ..utils import NoValueSentinel +from ..utils import DEFAULT_OUTPUT, NoValueSentinel from .op_decorator import _Op @@ -465,7 +465,12 @@ def asset_keys(self) -> Set[AssetKey]: @cached_property def check_specs_by_output_name(self) -> Mapping[str, AssetCheckSpec]: - return create_check_specs_by_output_name(self.args.check_specs) + cs_by_name = create_check_specs_by_output_name(self.args.check_specs) + if self.args.decorator_name == "@asset_check": + check.invariant(len(cs_by_name) == 1, "Must have exactly one check spec") + return {DEFAULT_OUTPUT: next(iter(cs_by_name.values()))} + + return cs_by_name @cached_property def check_outs_by_output_name(self) -> Mapping[str, Out]: