You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrading from constructs 10.4.2 to 10.4.3, my dependency manager began pulling in typeguard 4.x (instead of <3), which caused AWS CDK (aws-cdk-lib) to emit large numbers of
runtime warnings during cdk synth and bundling operations.
Downgrading constructs back to 10.4.2 immediately caused typeguard to be resolved
back to 2.x, and the warnings disappeared.
This suggests that constructs 10.4.3 has relaxed or altered its dependency constraints in a way
that allows jsii to resolve to a version compatible with typeguard>=4, which is currently
not fully compatible with CDK’s runtime type checking behavior.
Environment
Python 3.13
aws-cdk-lib: 2.223.0
jsii: resolved via constructs (1.119.0)
typeguard: 2.13.3 → 4.2.1 after upgrading constructs
Impact
typeguard 4.x introduces strict Protocol checking, and CDK uses many non-runtime-checkable
Protocols (IRole, IVpc, IFunction, etc.). This results in hundreds of warnings, like the following:
UserWarning: Typeguard cannot check the IRole protocol because it is a non-runtime protocol. If you would like to type check this protocol, please use @typing.runtime_checkable
typeguard.check_type(value=value, expected_type=expected_type, collection_check_strategy=typeguard.CollectionCheckStrategy.ALL_ITEMS) # type:ignore
Reacted by captrob, PhilippPHoffmann, Tom Q and John Cuyle
Activity
mjgoble commentedon Nov 12, 2025
@mrgrain @rix0rrr
rix0rrr commentedon Nov 19, 2025
10.4.2
'typeguard~=2.13.3',10.4.3
'typeguard>=2.13.3,<4.3.0',fix: Typeguard cannot check the protocol (#4986)
mrgrain commentedon Nov 19, 2025
Fix is not yet released. Keeping open.
otaviomacedo commentedon Dec 10, 2025
The fix was released in version 1.120.0. @mjgoble can you confirm the fix?
mrgrain commentedon Dec 11, 2025
@otaviomacedo we need a constructs release for this first. I'm on it.
Revert "Update typeguard" - protocol issue not resolved