Skip to content

E2531, E2533 and W2531 crash on a runtime whose block dates are not yet scheduled #4944

Closed

Description

@kddejong

E2531, E2533 and W2531 crash on a runtime whose block dates are not yet scheduled

CloudFormation Lint Version

main (reproduced at 6e5000d9b)

What happened

LmbdRuntimeLifecycle.json allows create-block and update-block to be null, which is how AWS publishes a runtime whose deprecation date is announced but whose block dates are not yet scheduled. All three rules that read the file call datetime.strptime on those values without a null guard, so the runtime raises instead of being validated.

Resources:
  Fn:
    Type: AWS::Lambda::Function
    Properties:
      Runtime: dotnet9
      Handler: index.handler
      Role: arn:aws:iam::123456789012:role/MyRole
      Code:
        ZipFile: "x"
E1101 Exception 'strptime() argument 1 must be str, not None' raised while validating 'cfnLint'
template.yaml:5:7

dotnet9 is the only entry in the file with null block dates today:

"dotnet9": {"create-block": null, "deprecated": "2026-11-10", "successor": "dotnet10", "update-block": null}

That matches the Lambda runtimes page, which gives dotnet9 a deprecation date of 2026-11-10 and "Not scheduled" for both block columns. The data is correct — AWS announces a deprecation date first and the block dates later, so this is a real intermediate state, not a transcription error.

Where each rule breaks

# W2531 (DeprecatedRuntimeEol)
datetime.strptime(runtime_data["deprecated"], "%Y-%m-%d") <= current_date
and datetime.strptime(runtime_data["create-block"], "%Y-%m-%d")
and datetime.strptime(runtime_data["update-block"], "%Y-%m-%d")

# E2531 (DeprecatedRuntimeCreate)
datetime.strptime(runtime_data["create-block"], "%Y-%m-%d") <= current_date

# E2533 (DeprecatedRuntimeUpdate)
datetime.strptime(runtime_data["update-block"], "%Y-%m-%d") <= current_date

E2531 and E2533 raise today. W2531 survives only because Python's and short-circuits on the deprecation comparison, which is still false. Measured by freezing the clock the way the rule's own tests do:

2026-10-27  W2531 -> 0 error(s)
2026-11-10  W2531 -> RAISES TypeError: strptime() argument 1 must be str, not None

So on 2026-11-10, when dotnet9's deprecation date passes, the third rule joins the other two.

Why this matters beyond dotnet9

Real-world impact today is small, because dotnet9 is absent from the Runtime enum and so draws E3030 as well — few templates will carry it.

The durable problem is that this is AWS's normal announcement sequence, so every runtime passes through "deprecation announced, blocks unscheduled" on its way to being fully scheduled. The only way to avoid the crash right now is to leave such a runtime out of the file entirely, which is what PR #4943 does for nodejs26.x and python3.15. That workaround suppresses the finding users most want: a warning that a runtime is deprecated. Nobody would be told, purely because AWS has not yet said when creates get blocked.

Note that nodejs26.x and python3.15 are in the Runtime enum, so they are lintable and are the next candidates to hit this.

Suggested fix

Treat a null block date as "not yet scheduled" rather than as a date:

  • W2531 should fire on the deprecation date alone, and omit or soften the block-date clauses of its message when they are null. This is the useful finding in the unscheduled state.
  • E2531 should stay silent while create-block is null — CloudFormation is not refusing creates yet, so an error would be a false positive.
  • E2533 should stay silent while update-block is null, for the same reason.

That also lets the file carry every announced runtime rather than omitting the unscheduled ones.

Worth adding a test case per rule for a null-block entry, since nothing currently covers it — the suite is green with this crash present.

Unrelated, noticed while reproducing

dotnet9 is missing from the AWS::Lambda::Function Runtime enum while dotnet10 is present. That is a schema gap and belongs in resource-provider-enhanced-schemas, not here.

Activity

  1. added a commit that references this issue on Oct 27, 2026
    bd8db79
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions