Skip to content

Bug: (SAM CLI) Unexpected error running 'sam validate' #8092

Open
@smathez

Description

@smathez

Description:

Since I upgraded sam cli to version 1.140, I get the error below every time I try to run sam validate on my templates.

Steps to reproduce:

run sam validate --lint on a sam template

Observed result:

Error: Tried to append rules but got an error: cannot import name 'RESOURCE_SPECS' from 'cfnlint.helpers' (/usr/local/aws-sam-cli/1.140.0/dist/_internal/cfnlint/helpers.pyc)
Traceback:
File "click/core.py", line 1082, in main
File "click/core.py", line 1697, in invoke
File "click/core.py", line 1443, in invoke
File "click/core.py", line 788, in invoke
File "samcli/cli/cli_config_file.py", line 347, in wrapper
File "click/decorators.py", line 92, in new_func
File "click/core.py", line 788, in invoke
File "samcli/lib/telemetry/metric.py", line 185, in wrapped
File "samcli/lib/telemetry/metric.py", line 150, in wrapped
File "samcli/lib/utils/version_checker.py", line 43, in wrapped
File "samcli/cli/main.py", line 95, in wrapper
File "samcli/commands/_utils/cdk_support_decorators.py", line 40, in wrapped
File "samcli/commands/_utils/command_exception_handler.py", line 89, in wrapper_command_exception_handler
File "samcli/commands/_utils/command_exception_handler.py", line 69, in wrapper_command_exception_handler
File "samcli/commands/validate/validate.py", line 70, in cli
File "samcli/commands/validate/validate.py", line 87, in do_cli
File "samcli/commands/validate/validate.py", line 176, in _lint
File "cfnlint/api.py", line 62, in lint
runner = Runner(config_mixin)
^^^^^^^^^^^^^^^^^^^^
File "cfnlint/runner.py", line 233, in init
self._get_rules()
File "cfnlint/runner.py", line 262, in _get_rules
raise UnexpectedRuleException(

An unexpected error was encountered while executing "sam validate".

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

{
  "version": "1.140.0",
  "system": {
    "python": "3.11.10",
    "os": "Linux-6.6.87.1-microsoft-standard-WSL2-x86_64-with-glibc2.35"
  },
  "additional_dependencies": {
    "docker_engine": "Not available",
    "aws_cdk": "Not available",
    "terraform": "1.12.2"
  },
  "available_beta_feature_env_vars": [
    "SAM_CLI_BETA_FEATURES",
    "SAM_CLI_BETA_BUILD_PERFORMANCE",
    "SAM_CLI_BETA_TERRAFORM_SUPPORT",
    "SAM_CLI_BETA_PACKAGE_PERFORMANCE",
    "SAM_CLI_BETA_RUST_CARGO_LAMBDA"
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    stage/needs-triageAutomatically applied to new issues and PRs, indicating they haven't been looked at.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions